https://docs.grit.io/cli/quickstart
engine marzano(0.1)
language js
private pattern handle_custom_i18n() {
https://docs.grit.io/cli/quickstart
engine marzano(0.1)
language js
private pattern handle_custom_i18n() {
| import { MigrateUpArgs, MigrateDownArgs } from '@payloadcms/db-mongodb'; | |
| import { Field, RichTextField, BlockField } from 'payload/dist/fields/config/types'; | |
| import { CollectionModel } from '@payloadcms/db-mongodb/dist/types'; | |
| /** | |
| * Migration steps: | |
| * 1. Go and change all your fields to `richText` instead of plugin's wrapper | |
| * 2. Run a migration | |
| * | |
| * This migration supports: |
| # Run it in the place where is your `lingui.config` is located | |
| # ts-node ./migrate.ts | |
| import { | |
| CatalogType, | |
| ExtractedMessageType, | |
| getConfig, | |
| LinguiConfigNormalized, | |
| MessageType, | |
| } from "@lingui/conf" |
| const webpack = require('webpack'); | |
| const os = require('os'); | |
| const rimraf = require('rimraf'); | |
| const helpers = require('../helpers'); | |
| const gutil = require('gulp-util'); | |
| const argv = require('process').argv; | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const {statsToString, statsErrorsToString, statsWarningsToString} = require('../stats'); | |
| const {getEmittedFiles} = require('@angular-devkit/build-webpack/src/utils'); |
| 'use strict'; | |
| module.exports = function (file, api, options) { | |
| const j = api.jscodeshift; | |
| const source = j(file.source); | |
| const body = source.find(j.Program).get('body'); | |
| delete body.value[0].comments; | |
| let jobDone = false; | |
| const classConstructor = source.find(j.FunctionDeclaration, |
| 'use strict'; | |
| module.exports = function (file, api) { | |
| const j = api.jscodeshift; | |
| const source = j(file.source); | |
| const body = source.find(j.Program).get('body'); | |
| delete body.value[0].comments; | |
| let jobDone = false; | |
| const factoryCall = source.find(j.CallExpression, (node) => ( |
| #set($cmpName = "") | |
| #foreach($str in $NAME.split("-")) | |
| #set($str = $str.substring(0,1).toUpperCase()+$str.substring(1)) | |
| #set($cmpName = $cmpName + $str) | |
| #end | |
| import React, { Component } from 'react'; | |
| import PropTypes from 'prop-types'; | |
| export class ${cmpName} extends Component { | |
| static propTypes = { |
| var path = require('path'); | |
| var fs = require('fs'); | |
| module.exports = function (file, api, options) { | |
| const j = api.jscodeshift; | |
| const ast = j(file.source); | |
| const body = ast.find(j.Program).get('body'); | |
| // Find each angular.<method>() usage | |
| var moduleUsages = ast.find(j.CallExpression, isModuleExpression) |
| module.exports = function (file, api) { | |
| const j = api.jscodeshift; | |
| const ast = j(file.source); | |
| const body = ast.find(j.Program).get('body'); | |
| // Find each angular.<method>() usage | |
| var angularUsages = ast.find(j.MemberExpression, isAngularExpression); | |
| if (angularUsages.length === 0) { | |
| return null; |
| module.exports = function(fileInfo, { jscodeshift: j }) { | |
| const ast = j(fileInfo.source); | |
| const body = ast.find(j.Program).get("body"); | |
| const getFirstNode = () => ast.find(j.Program).get('body', 0).node; | |
| // Save the comments attached to the first node | |
| const firstNode = getFirstNode(); | |
| const { comments } = firstNode; | |
| ast |