@react-foundry/plop-pack 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +42 -0
- package/package.json +38 -0
- package/skel/app/.dockerignore +9 -0
- package/skel/app/Dockerfile +32 -0
- package/skel/app/Makefile.hbs +87 -0
- package/skel/app/README.md.hbs +91 -0
- package/skel/app/aws-lambda-entry.js +3 -0
- package/skel/app/cypress.config.mjs +6 -0
- package/skel/app/feat/home.spec.js +5 -0
- package/skel/app/gitignore +10 -0
- package/skel/app/jest.config.cjs +15 -0
- package/skel/app/lambda.Dockerfile +23 -0
- package/skel/app/package.json.hbs +61 -0
- package/skel/app/plopfile.mjs +5 -0
- package/skel/app/public/favicon.ico +0 -0
- package/skel/app/react-router.config.ts +13 -0
- package/skel/app/src/app/app.scss +0 -0
- package/skel/app/src/app/config.ts.hbs +1 -0
- package/skel/app/src/app/entry.client.tsx +17 -0
- package/skel/app/src/app/entry.server.tsx +85 -0
- package/skel/app/src/app/root.tsx +141 -0
- package/skel/app/src/app/routes/_index.tsx +23 -0
- package/skel/app/src/app/routes.ts +6 -0
- package/skel/app/src/server/config.ts +59 -0
- package/skel/app/src/server/dev.ts +13 -0
- package/skel/app/src/server/httpd.ts +49 -0
- package/skel/app/src/server/index.ts +33 -0
- package/skel/app/src/server/server-build.d.ts +14 -0
- package/skel/app/test.Dockerfile +18 -0
- package/skel/app/tsconfig.json +19 -0
- package/skel/app/vite.config.server.ts +24 -0
- package/skel/app/vite.config.ts +20 -0
- package/skel/component/README.md.hbs +66 -0
- package/skel/component/assets/Component.scss.hbs +9 -0
- package/skel/component/gitignore +5 -0
- package/skel/component/jest.config.js.hbs +15 -0
- package/skel/component/package.json.hbs +72 -0
- package/skel/component/spec/Component.mdx.hbs +19 -0
- package/skel/component/spec/Component.stories.tsx.hbs +22 -0
- package/skel/component/spec/Component.ts.hbs +28 -0
- package/skel/component/src/Component.tsx.hbs +32 -0
- package/skel/component/tsconfig.json +14 -0
- package/skel/lib/README.md.hbs +51 -0
- package/skel/lib/gitignore +5 -0
- package/skel/lib/jest.config.js.hbs +15 -0
- package/skel/lib/package.json.hbs +44 -0
- package/skel/lib/src/index.ts.hbs +6 -0
- package/skel/lib/tsconfig.json +14 -0
- package/src/action-paths.js +39 -0
- package/src/actions/copy.js +27 -0
- package/src/actions/merge.js +26 -0
- package/src/actions/message.js +3 -0
- package/src/actions/shell.js +21 -0
- package/src/actions/symlink.js +42 -0
- package/src/actions/write.js +20 -0
- package/src/extend-generator.js +38 -0
- package/src/generators/app.js +140 -0
- package/src/generators/component.js +73 -0
- package/src/generators/lib.js +54 -0
- package/src/helpers/eq.js +3 -0
- package/src/helpers/md-title.js +6 -0
- package/src/index.js +38 -0
- package/src/rel-to-skel.js +9 -0
- package/src/relative-path.js +5 -0
- package/src/run-plop.js +24 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC, createElement as h } from 'react';
|
|
2
|
+
import { StandardProps, classBuilder } from '@react-foundry/component-helpers';
|
|
3
|
+
|
|
4
|
+
import '../assets/{{{properCase name}}}.scss';
|
|
5
|
+
|
|
6
|
+
export type {{{properCase name}}}Props = StandardProps & {
|
|
7
|
+
/** Description for the 'heading' prop */
|
|
8
|
+
heading?: string
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const {{{properCase name}}}: FC<{{{properCase name}}}Props> = ({
|
|
12
|
+
children,
|
|
13
|
+
classBlock,
|
|
14
|
+
classModifiers,
|
|
15
|
+
className,
|
|
16
|
+
heading,
|
|
17
|
+
...attrs
|
|
18
|
+
}) => {
|
|
19
|
+
const classes = classBuilder('{{{dashCase (pkg 'name')}}}-{{{dashCase name}}}', classBlock, classModifiers, className);
|
|
20
|
+
const title = heading || '{{{name}}}';
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div {...attrs} className={classes()}>
|
|
24
|
+
<h1 className={classes('heading')}>{title}</h1>
|
|
25
|
+
{children}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
{{{properCase name}}}.displayName = '{{{properCase name}}}';
|
|
31
|
+
|
|
32
|
+
export default {{{properCase name}}};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{{#mdTitle}}{{{titleCase (pkg 'name')}}} - {{{titleCase name}}}{{/mdTitle}}
|
|
2
|
+
|
|
3
|
+
{{{description}}}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
Using this package
|
|
7
|
+
------------------
|
|
8
|
+
|
|
9
|
+
First install the package into your project:
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
npm install -S @{{{pkg 'name'}}}/{{{name}}}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Then use it in your code as follows:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import {{{camelCase name}}} from '@{{{pkg 'name'}}}/{{{name}}}';
|
|
19
|
+
|
|
20
|
+
// WRITEME
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
Working on this package
|
|
26
|
+
-----------------------
|
|
27
|
+
|
|
28
|
+
Before working on this package you must install its dependencies using
|
|
29
|
+
the following command:
|
|
30
|
+
|
|
31
|
+
```shell
|
|
32
|
+
pnpm install
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Building
|
|
37
|
+
|
|
38
|
+
Build the package by compiling the source code.
|
|
39
|
+
|
|
40
|
+
```shell
|
|
41
|
+
npm run build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Clean-up
|
|
46
|
+
|
|
47
|
+
Remove any previously built files.
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
npm run clean
|
|
51
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const baseConfig = require('../../jest.config.base');
|
|
4
|
+
|
|
5
|
+
const config = {
|
|
6
|
+
...baseConfig,
|
|
7
|
+
collectCoverageFrom: [
|
|
8
|
+
'<rootDir>/src/**.{ts,tsx}',
|
|
9
|
+
],
|
|
10
|
+
testMatch: [
|
|
11
|
+
'<rootDir>/spec/**.{ts,tsx}'
|
|
12
|
+
]
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
module.exports = config;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@{{{pkg 'name'}}}/{{{name}}}",
|
|
3
|
+
"version": "{{{pkg 'version'}}}",
|
|
4
|
+
"description": "{{{description}}}",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"module": "dist/index.mjs",
|
|
12
|
+
"typings": "dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"default": "./dist/index.mjs",
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"/dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
27
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
28
|
+
"build": "npm run build:esm && npm run build:cjs",
|
|
29
|
+
"build:esm": "tsc -m es2022 && find dist -name '*.js' -exec sh -c 'mv \"$0\" \"${0%.js}.mjs\"' {} \\;",
|
|
30
|
+
"build:cjs": "tsc",
|
|
31
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
32
|
+
},
|
|
33
|
+
"author": "{{{pkg 'author'}}}",
|
|
34
|
+
"license": "{{{pkg 'license'}}}",
|
|
35
|
+
"engines": {
|
|
36
|
+
"node" : ">=22.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"jest": "30.2.0",
|
|
40
|
+
"jest-environment-jsdom": "30.2.0",
|
|
41
|
+
"ts-jest": "29.4.6",
|
|
42
|
+
"typescript": "5.9.3"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Some of the code here is based on code from 'node-plop' which is
|
|
2
|
+
// licensed under the MIT license and is copyright 2016 Andrew Worcester.
|
|
3
|
+
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
const normalisePath = filePath => (
|
|
7
|
+
!path.sep || path.sep === '\\'
|
|
8
|
+
? filePath.replace(/\\/g, '/')
|
|
9
|
+
: filePath
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export const actionPaths = (data, cfg, plop) => {
|
|
13
|
+
const destBasePath = plop.getDestBasePath();
|
|
14
|
+
const plopfilePath = plop.getPlopfilePath();
|
|
15
|
+
const fullData = { ...cfg.data, ...data };
|
|
16
|
+
|
|
17
|
+
const dest = filePath => {
|
|
18
|
+
const normalPath = normalisePath(filePath) || '';
|
|
19
|
+
|
|
20
|
+
return path.resolve(
|
|
21
|
+
destBasePath,
|
|
22
|
+
plop.renderString(normalPath, fullData)
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const pretty = filePath => (
|
|
27
|
+
'/' + path.relative(destBasePath, filePath)
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const source = filePath => path.resolve(plopfilePath, filePath);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
dest,
|
|
34
|
+
pretty,
|
|
35
|
+
source
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default actionPaths;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import actionPaths from '../action-paths.js';
|
|
4
|
+
|
|
5
|
+
const plopActionCopy = (answers, config, plop) => {
|
|
6
|
+
const paths = actionPaths(answers, config, plop);
|
|
7
|
+
const dest = paths.dest(config.destination);
|
|
8
|
+
const source = paths.source(config.source);
|
|
9
|
+
const prettyDest = paths.pretty(dest);
|
|
10
|
+
const exclude = config.exclude || ['hbs'];
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
fs.copy(source, dest, {
|
|
14
|
+
overwrite: config.overwrite || false,
|
|
15
|
+
errorOnExist: true,
|
|
16
|
+
dereference: true,
|
|
17
|
+
filter: config.filter || (
|
|
18
|
+
(src) => exclude
|
|
19
|
+
.map(v => !src.endsWith(`.${v}`))
|
|
20
|
+
.reduce((acc, cur) => cur && acc, true)
|
|
21
|
+
)
|
|
22
|
+
})
|
|
23
|
+
.then(() => `${prettyDest}`)
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default plopActionCopy;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import actionPaths from '../action-paths.js';
|
|
4
|
+
|
|
5
|
+
const plopActionMerge = (answers, config, plop) => new Promise(
|
|
6
|
+
(resolve, reject) => {
|
|
7
|
+
const paths = actionPaths(answers, config, plop);
|
|
8
|
+
const file = paths.dest(config.path);
|
|
9
|
+
const prettyFile = paths.pretty(file);
|
|
10
|
+
const templateFile = paths.source(config.templateFile);
|
|
11
|
+
const readOptions = { encoding: 'utf8' };
|
|
12
|
+
const original = fs.readJsonSync(file, readOptions);
|
|
13
|
+
const update = JSON.parse(
|
|
14
|
+
plop.renderString(
|
|
15
|
+
fs.readFileSync(templateFile, readOptions),
|
|
16
|
+
{ ...config.data, ...answers }
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
|
+
const data = _.merge({}, original, update);
|
|
20
|
+
|
|
21
|
+
fs.writeJsonSync(file, data, { spaces: 2 });
|
|
22
|
+
resolve(prettyFile);
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default plopActionMerge;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import shell from 'shelljs';
|
|
2
|
+
|
|
3
|
+
const exec = (command, options) => new Promise(
|
|
4
|
+
(resolve, reject) => {
|
|
5
|
+
const r = shell.exec(command, { ...options, async: false });
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
r.code === 0
|
|
9
|
+
? resolve()
|
|
10
|
+
: reject(r.stderr)
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const plopActionShell = (answers, config, plop) => {
|
|
16
|
+
const command = plop.renderString(config.command, answers);
|
|
17
|
+
|
|
18
|
+
return exec(command).then(() => command);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default plopActionShell;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import shell from 'shelljs';
|
|
3
|
+
import actionPaths from '../action-paths.js';
|
|
4
|
+
|
|
5
|
+
const symlinkOrCopy = (source, dest, topDir) => new Promise(
|
|
6
|
+
(resolve, reject) => {
|
|
7
|
+
const to = path.relative(path.dirname(dest), source);
|
|
8
|
+
const shouldCopy = to.includes('node_modules') || path.relative(topDir, source).includes('..');
|
|
9
|
+
const resultType = (
|
|
10
|
+
shouldCopy
|
|
11
|
+
? 'file'
|
|
12
|
+
: 'symlink'
|
|
13
|
+
);
|
|
14
|
+
const r = (
|
|
15
|
+
shouldCopy
|
|
16
|
+
? shell.cp('-rnL', source, dest)
|
|
17
|
+
: shell.ln('-s', to, dest)
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
r.code === 0
|
|
22
|
+
? resolve(resultType)
|
|
23
|
+
: reject(r.stderr)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const plopActionSymlink = (answers, config, plop) => {
|
|
29
|
+
const paths = actionPaths(answers, config, plop);
|
|
30
|
+
const dest = paths.dest(config.path);
|
|
31
|
+
const source = paths.source(config.target);
|
|
32
|
+
const prettyDest = paths.pretty(dest);
|
|
33
|
+
const prettySource = paths.pretty(source);
|
|
34
|
+
|
|
35
|
+
return symlinkOrCopy(source, dest, plop.getDestBasePath()).then(t => (
|
|
36
|
+
t === 'symlink'
|
|
37
|
+
? `${prettyDest} -> ${prettySource}`
|
|
38
|
+
: prettyDest
|
|
39
|
+
));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default plopActionSymlink;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import actionPaths from '../action-paths.js';
|
|
3
|
+
|
|
4
|
+
const plopActionWrite = (answers, config, plop) => {
|
|
5
|
+
const paths = actionPaths(answers, config, plop);
|
|
6
|
+
const file = paths.dest(config.path);
|
|
7
|
+
const prettyFile = paths.pretty(file);
|
|
8
|
+
const data = config.content(answers);
|
|
9
|
+
const writeFileSync = (
|
|
10
|
+
typeof data === 'string'
|
|
11
|
+
? fs.writeFileSync
|
|
12
|
+
: fs.writeJsonSync
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
writeFileSync(file, data, { spaces: 2 });
|
|
16
|
+
|
|
17
|
+
return prettyFile;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default plopActionWrite;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import nodePlop from 'node-plop';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import resolve from 'resolve';
|
|
4
|
+
|
|
5
|
+
export const extendGenerator = async (plop, plopfilePath, generator, extension, actionsSpliceStart, actionsSpliceDeleteCount = 0) => {
|
|
6
|
+
const parentPath = resolve.sync(plopfilePath, { basedir: plop.getPlopfilePath() });
|
|
7
|
+
const parent = await nodePlop(parentPath, { destBasePath: plop.getDestBasePath() });
|
|
8
|
+
const { name, description, prompts, actions: _actions, basePath, runActions, runPrompts, ...rest } = parent.getGenerator(generator);
|
|
9
|
+
|
|
10
|
+
const patchPath = v => v && path.resolve(basePath, v);
|
|
11
|
+
const patchAction = action => ({
|
|
12
|
+
...action,
|
|
13
|
+
base: patchPath(action.base),
|
|
14
|
+
source: patchPath(action.source),
|
|
15
|
+
target: patchPath(action.target),
|
|
16
|
+
templateFile: patchPath(action.templateFile),
|
|
17
|
+
templateFiles: patchPath(action.templateFiles)
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const actions = _actions.map(patchAction);
|
|
21
|
+
|
|
22
|
+
const start = (
|
|
23
|
+
actionsSpliceStart === undefined
|
|
24
|
+
? _actions.length
|
|
25
|
+
: actionsSpliceStart
|
|
26
|
+
);
|
|
27
|
+
actions.splice(start, actionsSpliceDeleteCount, ...extension.actions);
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
...rest,
|
|
31
|
+
...extension,
|
|
32
|
+
description: extension.description || description,
|
|
33
|
+
prompts: [ ...prompts, ...extension.prompts ],
|
|
34
|
+
actions
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default extendGenerator;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import relToSkel from '../rel-to-skel.js';
|
|
2
|
+
|
|
3
|
+
const rel = relToSkel('app');
|
|
4
|
+
|
|
5
|
+
export const generator = {
|
|
6
|
+
description: 'Application',
|
|
7
|
+
prompts: [
|
|
8
|
+
{
|
|
9
|
+
type: 'input',
|
|
10
|
+
name: 'name',
|
|
11
|
+
message: 'Name (e.g. "my-app"):'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'input',
|
|
15
|
+
name: 'title',
|
|
16
|
+
message: 'Title (e.g. "My app"):'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'input',
|
|
20
|
+
name: 'description',
|
|
21
|
+
message: 'Description:'
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
actions: [
|
|
25
|
+
{
|
|
26
|
+
type: 'add',
|
|
27
|
+
path: 'apps/{{{name}}}/package.json',
|
|
28
|
+
templateFile: rel('package.json.hbs')
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'symlink',
|
|
32
|
+
path: 'apps/{{{name}}}/.dockerignore',
|
|
33
|
+
target: rel('.dockerignore')
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'copy',
|
|
37
|
+
destination: 'apps/{{{name}}}/.gitignore',
|
|
38
|
+
source: rel('gitignore')
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'copy',
|
|
42
|
+
destination: 'apps/{{{name}}}/aws-lambda-entry.js',
|
|
43
|
+
source: rel('aws-lambda-entry.js')
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'copy',
|
|
47
|
+
destination: 'apps/{{{name}}}/cypress.config.mjs',
|
|
48
|
+
source: rel('cypress.config.mjs')
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'symlink',
|
|
52
|
+
path: 'apps/{{{name}}}/Dockerfile',
|
|
53
|
+
target: rel('Dockerfile')
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'copy',
|
|
57
|
+
destination: 'apps/{{{name}}}/feat/',
|
|
58
|
+
source: rel('feat/')
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'copy',
|
|
62
|
+
destination: 'apps/{{{name}}}/jest.config.cjs',
|
|
63
|
+
source: rel('jest.config.cjs')
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'symlink',
|
|
67
|
+
path: 'apps/{{{name}}}/lambda.Dockerfile',
|
|
68
|
+
target: rel('lambda.Dockerfile')
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: 'add',
|
|
72
|
+
path: 'apps/{{{name}}}/Makefile',
|
|
73
|
+
templateFile: rel('Makefile.hbs')
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'copy',
|
|
77
|
+
destination: 'apps/{{{name}}}/plopfile.mjs',
|
|
78
|
+
source: rel('plopfile.mjs')
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'copy',
|
|
82
|
+
destination: 'apps/{{{name}}}/public/',
|
|
83
|
+
source: rel('public/')
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'copy',
|
|
87
|
+
destination: 'apps/{{{name}}}/react-router.config.ts',
|
|
88
|
+
source: rel('react-router.config.ts')
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'add',
|
|
92
|
+
path: 'apps/{{{name}}}/README.md',
|
|
93
|
+
templateFile: rel('README.md.hbs')
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: 'copy',
|
|
97
|
+
destination: 'apps/{{{name}}}/src/',
|
|
98
|
+
source: rel('src/')
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'add',
|
|
102
|
+
path: 'apps/{{{name}}}/src/app/config.ts',
|
|
103
|
+
templateFile: rel('src/app/config.ts.hbs')
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: 'symlink',
|
|
107
|
+
path: 'apps/{{{name}}}/test.Dockerfile',
|
|
108
|
+
target: rel('test.Dockerfile')
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'copy',
|
|
112
|
+
destination: 'apps/{{{name}}}/tsconfig.json',
|
|
113
|
+
source: rel('tsconfig.json')
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: 'copy',
|
|
117
|
+
destination: 'apps/{{{name}}}/vite.config.server.ts',
|
|
118
|
+
source: rel('vite.config.server.ts')
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: 'copy',
|
|
122
|
+
destination: 'apps/{{{name}}}/vite.config.ts',
|
|
123
|
+
source: rel('vite.config.ts')
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: 'modify',
|
|
127
|
+
path: '.github/workflows/change-assurance.yml',
|
|
128
|
+
pattern: /app: \[(.+?)( ?)\]/g,
|
|
129
|
+
template: 'app: [$1, \'{{{name}}}\'$2]'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: 'modify',
|
|
133
|
+
path: '.github/workflows/change-assurance.yml',
|
|
134
|
+
pattern: /app: \[\]/g,
|
|
135
|
+
template: 'app: [ \'{{{name}}}\' ]'
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export default generator;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import relToSkel from '../rel-to-skel.js';
|
|
2
|
+
|
|
3
|
+
const rel = relToSkel('component');
|
|
4
|
+
|
|
5
|
+
export const generator = {
|
|
6
|
+
description: 'Component',
|
|
7
|
+
prompts: [
|
|
8
|
+
{
|
|
9
|
+
type: 'input',
|
|
10
|
+
name: 'name',
|
|
11
|
+
message: 'Name (e.g. "My component"):'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'input',
|
|
15
|
+
name: 'description',
|
|
16
|
+
message: 'Description:'
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
actions: [
|
|
20
|
+
{
|
|
21
|
+
type: 'add',
|
|
22
|
+
path: 'components/{{{dashCase name}}}/jest.config.js',
|
|
23
|
+
templateFile: rel('jest.config.js.hbs')
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'add',
|
|
27
|
+
path: 'components/{{{dashCase name}}}/package.json',
|
|
28
|
+
templateFile: rel('package.json.hbs')
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'add',
|
|
32
|
+
path: 'components/{{{dashCase name}}}/README.md',
|
|
33
|
+
templateFile: rel('README.md.hbs')
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'copy',
|
|
37
|
+
destination: 'components/{{{dashCase name}}}/.gitignore',
|
|
38
|
+
source: rel('gitignore')
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'symlink',
|
|
42
|
+
path: 'components/{{{dashCase name}}}/tsconfig.json',
|
|
43
|
+
target: rel('tsconfig.json')
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'add',
|
|
47
|
+
path: 'components/{{{dashCase name}}}/assets/{{{properCase name}}}.scss',
|
|
48
|
+
templateFile: rel('assets/Component.scss.hbs')
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'add',
|
|
52
|
+
path: 'components/{{{dashCase name}}}/spec/{{{properCase name}}}.mdx',
|
|
53
|
+
templateFile: rel('spec/Component.mdx.hbs')
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'add',
|
|
57
|
+
path: 'components/{{{dashCase name}}}/spec/{{{properCase name}}}.stories.tsx',
|
|
58
|
+
templateFile: rel('spec/Component.stories.tsx.hbs')
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'add',
|
|
62
|
+
path: 'components/{{{dashCase name}}}/spec/{{{properCase name}}}.ts',
|
|
63
|
+
templateFile: rel('spec/Component.ts.hbs')
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'add',
|
|
67
|
+
path: 'components/{{{dashCase name}}}/src/{{{properCase name}}}.tsx',
|
|
68
|
+
templateFile: rel('src/Component.tsx.hbs')
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default generator;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import relToSkel from '../rel-to-skel.js';
|
|
2
|
+
|
|
3
|
+
const rel = relToSkel('lib');
|
|
4
|
+
|
|
5
|
+
export const generator = {
|
|
6
|
+
description: 'Library',
|
|
7
|
+
prompts: [
|
|
8
|
+
{
|
|
9
|
+
type: 'input',
|
|
10
|
+
name: 'name',
|
|
11
|
+
message: 'Name (e.g. "my-library"):'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'input',
|
|
15
|
+
name: 'description',
|
|
16
|
+
message: 'Description:'
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
actions: [
|
|
20
|
+
{
|
|
21
|
+
type: 'add',
|
|
22
|
+
path: 'lib/{{{name}}}/jest.config.js',
|
|
23
|
+
templateFile: rel('jest.config.js.hbs')
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'add',
|
|
27
|
+
path: 'lib/{{{name}}}/package.json',
|
|
28
|
+
templateFile: rel('package.json.hbs')
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'add',
|
|
32
|
+
path: 'lib/{{{name}}}/README.md',
|
|
33
|
+
templateFile: rel('README.md.hbs')
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'copy',
|
|
37
|
+
destination: 'lib/{{{name}}}/.gitignore',
|
|
38
|
+
source: rel('gitignore')
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'symlink',
|
|
42
|
+
path: 'lib/{{{name}}}/tsconfig.json',
|
|
43
|
+
target: rel('tsconfig.json')
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'addMany',
|
|
47
|
+
destination: 'lib/{{{name}}}/src/',
|
|
48
|
+
base: rel('src/'),
|
|
49
|
+
templateFiles: rel('src/**.hbs')
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default generator;
|