Skip to content

Commit 36a350a

Browse files
authored
Merge pull request #1016 from form8ion/beta
promote beta to stable
2 parents bb690ad + 94fc7e3 commit 36a350a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+433
-467
lines changed

.github/workflows/codeql.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
# Initializes the CodeQL tools for scanning.
4949
- name: Initialize CodeQL
50-
uses: github/codeql-action/init@6e5455904168f98c75d8e5ad848b4dc4ab3ae77e # v3.28.7
50+
uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
5151
with:
5252
languages: ${{ matrix.language }}
5353
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -61,7 +61,7 @@ jobs:
6161
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
6262
# If this step fails, then you should remove it and run the build manually (see below)
6363
- name: Autobuild
64-
uses: github/codeql-action/autobuild@6e5455904168f98c75d8e5ad848b4dc4ab3ae77e # v3.28.7
64+
uses: github/codeql-action/autobuild@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
6565

6666
# ℹ️ Command-line programs to run using the OS shell.
6767
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -74,6 +74,6 @@ jobs:
7474
# ./location_of_script_within_repo/buildscript.sh
7575

7676
- name: Perform CodeQL Analysis
77-
uses: github/codeql-action/analyze@6e5455904168f98c75d8e5ad848b4dc4ab3ae77e # v3.28.7
77+
uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
7878
with:
7979
category: "/language:${{matrix.language}}"

.github/workflows/node-ci.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
node-version-file: .nvmrc
2626
cache: npm
2727
- run: npm clean-install
28+
- run: npm install --global corepack@latest
2829
- run: corepack npm audit signatures
2930
- run: npm test
3031
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
@@ -34,8 +35,9 @@ jobs:
3435
matrix:
3536
node:
3637
- 18.19.0
37-
- 20.6.1
38-
- 22.0.0
38+
- 20.9.0
39+
- 22.11.0
40+
- 23
3941
steps:
4042
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4143
- name: Setup node

.github/workflows/scorecard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ jobs:
6767

6868
# Upload the results to GitHub's code scanning dashboard.
6969
- name: "Upload to code-scanning"
70-
uses: github/codeql-action/upload-sarif@6e5455904168f98c75d8e5ad848b4dc4ab3ae77e # v3.28.7
70+
uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
7171
with:
7272
sarif_file: results.sarif

README.md

+63-66
Original file line numberDiff line numberDiff line change
@@ -46,88 +46,85 @@ $ npm install @form8ion/javascript --save
4646
#### Import
4747

4848
```javascript
49-
const {dialects, projectTypes} = require('@form8ion/javascript-core');
49+
const {dialects, projectTypes} = await import('@form8ion/javascript-core');
5050
const {
5151
scaffold: scaffoldJavaScript,
5252
lift: liftJavascript,
5353
test: thisIsAJavaScriptProject,
5454
scaffoldUnitTesting,
5555
questionNames
56-
} = require('@form8ion/javascript');
56+
} = await import('./lib/index.js');
5757
```
5858

5959
#### Execute
6060

6161
```javascript
62-
(async () => {
63-
const accountName = 'form8ion';
64-
const projectRoot = process.cwd();
62+
const accountName = 'form8ion';
63+
const projectRoot = process.cwd();
64+
65+
await scaffoldJavaScript({
66+
projectRoot,
67+
projectName: 'project-name',
68+
visibility: 'Public',
69+
license: 'MIT',
70+
configs: {
71+
eslint: {scope: `@${accountName}`},
72+
remark: `@${accountName}/remark-lint-preset`,
73+
babelPreset: {name: `@${accountName}`, packageName: `@${accountName}/babel-preset`},
74+
commitlint: {name: `@${accountName}`, packageName: `@${accountName}/commitlint-config`}
75+
},
76+
plugins: {
77+
unitTestFrameworks: {},
78+
applicationTypes: {},
79+
packageTypes: {},
80+
packageBundlers: {},
81+
ciServices: {}
82+
},
83+
decisions: {
84+
[questionNames.DIALECT]: dialects.BABEL,
85+
[questionNames.NODE_VERSION_CATEGORY]: 'LTS',
86+
[questionNames.PACKAGE_MANAGER]: 'npm',
87+
[questionNames.PROJECT_TYPE]: projectTypes.PACKAGE,
88+
[questionNames.SHOULD_BE_SCOPED]: true,
89+
[questionNames.SCOPE]: accountName,
90+
[questionNames.AUTHOR_NAME]: 'Your Name',
91+
[questionNames.AUTHOR_EMAIL]: '[email protected]',
92+
[questionNames.AUTHOR_URL]: 'https://your.website.tld',
93+
[questionNames.UNIT_TESTS]: true,
94+
[questionNames.INTEGRATION_TESTS]: true,
95+
[questionNames.PROVIDE_EXAMPLE]: true
96+
}
97+
});
6598

66-
await scaffoldJavaScript({
99+
if (await thisIsAJavaScriptProject({projectRoot})) {
100+
await liftJavascript({
67101
projectRoot,
68-
projectName: 'project-name',
69-
visibility: 'Public',
70-
license: 'MIT',
71-
configs: {
72-
eslint: {scope: `@${accountName}`},
73-
remark: `@${accountName}/remark-lint-preset`,
74-
babelPreset: {name: `@${accountName}`, packageName: `@${accountName}/babel-preset`},
75-
commitlint: {name: `@${accountName}`, packageName: `@${accountName}/commitlint-config`}
76-
},
77-
plugins: {
78-
unitTestFrameworks: {},
79-
applicationTypes: {},
80-
packageTypes: {},
81-
packageBundlers: {},
82-
ciServices: {}
102+
configs: {eslint: {scope: '@foo'}},
103+
results: {
104+
dependencies: {javascript: {production: [], development: []}},
105+
scripts: {},
106+
eslint: {configs: [], ignore: {directories: []}},
107+
packageManager: 'npm'
83108
},
84-
decisions: {
85-
[questionNames.DIALECT]: dialects.BABEL,
86-
[questionNames.NODE_VERSION_CATEGORY]: 'LTS',
87-
[questionNames.PACKAGE_MANAGER]: 'npm',
88-
[questionNames.PROJECT_TYPE]: projectTypes.PACKAGE,
89-
[questionNames.SHOULD_BE_SCOPED]: true,
90-
[questionNames.SCOPE]: accountName,
91-
[questionNames.AUTHOR_NAME]: 'Your Name',
92-
[questionNames.AUTHOR_EMAIL]: '[email protected]',
93-
[questionNames.AUTHOR_URL]: 'https://your.website.tld',
94-
[questionNames.UNIT_TESTS]: true,
95-
[questionNames.INTEGRATION_TESTS]: true,
96-
[questionNames.PROVIDE_EXAMPLE]: true
97-
}
98-
});
99-
100-
if (await thisIsAJavaScriptProject({projectRoot})) {
101-
await liftJavascript({
102-
projectRoot,
103-
configs: {eslint: {scope: '@foo'}},
104-
results: {
105-
dependencies: [],
106-
devDependencies: [],
107-
scripts: {},
108-
eslint: {configs: [], ignore: {directories: []}},
109-
packageManager: 'npm'
110-
},
111-
enhancers: {
112-
PluginName: {
113-
test: () => true,
114-
lift: () => ({})
115-
}
109+
enhancers: {
110+
PluginName: {
111+
test: () => true,
112+
lift: () => ({})
116113
}
117-
});
118-
}
119-
120-
await scaffoldUnitTesting({
121-
projectRoot: process.cwd(),
122-
frameworks: {
123-
Mocha: {scaffold: options => options},
124-
Jest: {scaffold: options => options}
125-
},
126-
visibility: 'Public',
127-
vcs: {host: 'GitHub', owner: 'foo', name: 'bar'},
128-
decisions: {[questionNames.UNIT_TEST_FRAMEWORK]: 'Mocha'}
114+
}
129115
});
130-
})();
116+
}
117+
118+
await scaffoldUnitTesting({
119+
projectRoot: process.cwd(),
120+
frameworks: {
121+
Mocha: {scaffold: options => options},
122+
Jest: {scaffold: options => options}
123+
},
124+
visibility: 'Public',
125+
vcs: {host: 'GitHub', owner: 'foo', name: 'bar'},
126+
decisions: {[questionNames.UNIT_TEST_FRAMEWORK]: 'Mocha'}
127+
});
131128
```
132129

133130
### Documentation

docs/api/scaffold.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Language scaffolder for JavaScript projects
88
* [`projectRoot` __string__ (_required_)](#projectroot-string-required)
99
* [`projectName` __string__ (_required_)](#projectname-string-required)
1010
* [`description` __string__ (_optional_)](#description-string-optional)
11-
* [`pathWithinParent` __string__ (_required_)](#pathwithinparent-string-required)
11+
* [`pathWithinParent` __string__ (_optional_)](#pathwithinparent-string-optional)
1212
* [`license` __string__ (_required_)](#license-string-required)
1313
* [`decisions` __object__ (_optional_)](#decisions-object-optional)
1414
* [`visibility` __string__ (_required_)](#visibility-string-required)

example.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ import stubbedFs from 'mock-fs';
55
import * as td from 'testdouble';
66
import 'validate-npm-package-name';
77

8-
// remark-usage-ignore-next 10
8+
// remark-usage-ignore-next 11
99
stubbedFs({
1010
node_modules: stubbedFs.load(resolve('node_modules')),
1111
'.nvmrc': 'v1.2.3',
1212
lib: stubbedFs.load(resolve('lib')),
1313
templates: stubbedFs.load(resolve('templates'))
1414
});
15-
const execa = td.replace('execa');
15+
const {execa} = await td.replaceEsm('execa');
1616
td.when(execa('. ~/.nvm/nvm.sh && nvm ls-remote --lts', {shell: true}))
1717
.thenResolve({stdout: ['v16.5.4', ''].join('\n')});
1818
td.when(execa('. ~/.nvm/nvm.sh && nvm install', {shell: true})).thenReturn({stdout: {pipe: () => undefined}});
19+
td.when(execa('npm', ['--version'])).thenResolve({stdout: '10.6.18'});
1920

2021
const {dialects, projectTypes} = await import('@form8ion/javascript-core');
2122
const {
@@ -69,8 +70,7 @@ if (await thisIsAJavaScriptProject({projectRoot})) {
6970
projectRoot,
7071
configs: {eslint: {scope: '@foo'}},
7172
results: {
72-
dependencies: [],
73-
devDependencies: [],
73+
dependencies: {javascript: {production: [], development: []}},
7474
scripts: {},
7575
eslint: {configs: [], ignore: {directories: []}},
7676
packageManager: 'npm'

0 commit comments

Comments
 (0)