@kvihaugen/create-frontend-app 1.0.4 → 1.0.5
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/.gitattributes +2 -0
- package/.github/workflows/build-and-publish.yaml +35 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/package.json +9 -14
- package/src/index.ts +49 -0
- package/tsconfig.json +29 -0
package/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Build and publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build-and-publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout repository
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '20'
|
|
23
|
+
registry-url: 'https://registry.npmjs.org'
|
|
24
|
+
|
|
25
|
+
- name: Update NPM
|
|
26
|
+
run: npm install -g npm@latest
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: npm ci
|
|
30
|
+
|
|
31
|
+
- name: Build project
|
|
32
|
+
run: npm run build --if-present
|
|
33
|
+
|
|
34
|
+
- name: Publish artifact
|
|
35
|
+
run: npm publish
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import degit from "degit";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { execSync } from "node:child_process";
|
|
7
|
+
const cwd = process.cwd();
|
|
8
|
+
(async () => {
|
|
9
|
+
console.log("🔃 Creating frontend app...");
|
|
10
|
+
const emitter = degit("LarsSK06/frontend-template");
|
|
11
|
+
const tempFolderPath = path.join(os.tmpdir(), `${Date.now()}-create-frontend-app`);
|
|
12
|
+
await emitter.clone(tempFolderPath);
|
|
13
|
+
execSync("npx create-next-app . --yes --empty --skip-install");
|
|
14
|
+
for (const objName of [
|
|
15
|
+
"src",
|
|
16
|
+
"public",
|
|
17
|
+
"postcss.config.mjs",
|
|
18
|
+
"next.config.ts"
|
|
19
|
+
]) {
|
|
20
|
+
const absoluteCwdPath = path.join(cwd, objName);
|
|
21
|
+
const absoluteTempFolderPath = path.join(tempFolderPath, objName);
|
|
22
|
+
if (fs.existsSync(absoluteCwdPath)) {
|
|
23
|
+
const stat = fs.statSync(absoluteCwdPath);
|
|
24
|
+
if (stat.isFile())
|
|
25
|
+
fs.unlinkSync(absoluteCwdPath);
|
|
26
|
+
else
|
|
27
|
+
fs.rmSync(absoluteCwdPath, { recursive: true, force: true });
|
|
28
|
+
}
|
|
29
|
+
fs.cpSync(absoluteTempFolderPath, absoluteCwdPath, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
console.log("✅ Created frontend app!");
|
|
32
|
+
})();
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC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,32 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvihaugen/create-frontend-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
6
|
"bin": {
|
|
10
|
-
"create-frontend-app": "dist/index.js"
|
|
7
|
+
"create-frontend-app": "./dist/index.js"
|
|
11
8
|
},
|
|
12
9
|
"scripts": {
|
|
13
|
-
"build": "tsc"
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"prepublishOnly": "npm run build"
|
|
14
12
|
},
|
|
15
|
-
"files": ["dist"],
|
|
16
13
|
"author": "",
|
|
17
14
|
"license": "MIT",
|
|
18
15
|
"description": "",
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"chalk": "^5.6.2",
|
|
21
|
-
"ora": "^9.0.0",
|
|
22
|
-
"prompts": "^2.4.2"
|
|
23
|
-
},
|
|
24
16
|
"devDependencies": {
|
|
25
|
-
"@types/
|
|
17
|
+
"@types/degit": "^2.8.6",
|
|
26
18
|
"@types/node": "^24.10.0",
|
|
27
|
-
"@types/ora": "^3.1.0",
|
|
28
19
|
"@types/prompts": "^2.4.9",
|
|
29
20
|
"ts-node": "^10.9.2",
|
|
30
21
|
"typescript": "^5.9.3"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"degit": "^2.8.4",
|
|
25
|
+
"prompts": "^2.4.2"
|
|
31
26
|
}
|
|
32
27
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import degit from "degit";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
|
|
8
|
+
import { execSync } from "node:child_process";
|
|
9
|
+
|
|
10
|
+
const cwd = process.cwd();
|
|
11
|
+
|
|
12
|
+
(async () => {
|
|
13
|
+
|
|
14
|
+
console.log("🔃 Creating frontend app...");
|
|
15
|
+
|
|
16
|
+
const emitter = degit("LarsSK06/frontend-template");
|
|
17
|
+
|
|
18
|
+
const tempFolderPath = path.join(os.tmpdir(), `${Date.now()}-create-frontend-app`);
|
|
19
|
+
|
|
20
|
+
await emitter.clone(tempFolderPath);
|
|
21
|
+
|
|
22
|
+
execSync("npx create-next-app . --yes --empty --skip-install");
|
|
23
|
+
|
|
24
|
+
for (const objName of [
|
|
25
|
+
"src",
|
|
26
|
+
"public",
|
|
27
|
+
"postcss.config.mjs",
|
|
28
|
+
"next.config.ts"
|
|
29
|
+
]) {
|
|
30
|
+
const absoluteCwdPath = path.join(cwd, objName);
|
|
31
|
+
const absoluteTempFolderPath = path.join(tempFolderPath, objName);
|
|
32
|
+
|
|
33
|
+
if (fs.existsSync(absoluteCwdPath)) {
|
|
34
|
+
const stat = fs.statSync(absoluteCwdPath);
|
|
35
|
+
|
|
36
|
+
if (stat.isFile()) fs.unlinkSync(absoluteCwdPath);
|
|
37
|
+
else fs.rmSync(absoluteCwdPath, { recursive: true, force: true });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
fs.cpSync(
|
|
41
|
+
absoluteTempFolderPath,
|
|
42
|
+
absoluteCwdPath,
|
|
43
|
+
{ recursive: true }
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
console.log("✅ Created frontend app!");
|
|
48
|
+
|
|
49
|
+
})();
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"rootDir": "./src",
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"module": "nodenext",
|
|
6
|
+
"target": "esnext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"declarationMap": true,
|
|
11
|
+
"noUncheckedIndexedAccess": true,
|
|
12
|
+
"exactOptionalPropertyTypes": true,
|
|
13
|
+
// "noImplicitReturns": true,
|
|
14
|
+
// "noImplicitOverride": true,
|
|
15
|
+
// "noUnusedLocals": true,
|
|
16
|
+
// "noUnusedParameters": true,
|
|
17
|
+
// "noFallthroughCasesInSwitch": true,
|
|
18
|
+
// "noPropertyAccessFromIndexSignature": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"jsx": "react-jsx",
|
|
21
|
+
"verbatimModuleSyntax": true,
|
|
22
|
+
"isolatedModules": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true,
|
|
24
|
+
"moduleDetection": "force",
|
|
25
|
+
"skipLibCheck": true
|
|
26
|
+
},
|
|
27
|
+
"include": ["src/**/*"],
|
|
28
|
+
"exclude": ["node_modules", "dist"]
|
|
29
|
+
}
|