@dword-design/base-config-app 9.0.1 → 9.0.3
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/dist/get-ecosystem-config.d.ts +0 -5
- package/dist/get-ecosystem-config.js +4 -29
- package/dist/index.js +11 -16
- package/package.json +1 -6
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
declare const _default: (packageConfig: {
|
|
2
2
|
name: string;
|
|
3
|
-
}, { cwd }?: {
|
|
4
|
-
cwd?: string | undefined;
|
|
5
3
|
}) => {
|
|
6
4
|
apps: {
|
|
7
5
|
args: string;
|
|
@@ -10,8 +8,5 @@ declare const _default: (packageConfig: {
|
|
|
10
8
|
name: any;
|
|
11
9
|
script: string;
|
|
12
10
|
}[];
|
|
13
|
-
deploy: {
|
|
14
|
-
production: any;
|
|
15
|
-
};
|
|
16
11
|
};
|
|
17
12
|
export default _default;
|
|
@@ -1,38 +1,13 @@
|
|
|
1
|
-
import pathLib from "node:path";
|
|
2
|
-
import fs from "fs-extra";
|
|
3
|
-
import hostedGitInfo from "hosted-git-info";
|
|
4
|
-
import parseGitConfig from "parse-git-config";
|
|
5
1
|
import parsePackagejsonName from "parse-packagejson-name";
|
|
6
|
-
export default
|
|
7
|
-
cwd = "."
|
|
8
|
-
} = {}) => {
|
|
9
|
-
const repositoryUrl = fs.existsSync(pathLib.join(cwd, ".git")) ? parseGitConfig.sync({
|
|
10
|
-
cwd
|
|
11
|
-
})['remote "origin"']?.url : void 0;
|
|
12
|
-
const gitInfo = hostedGitInfo.fromUrl(repositoryUrl);
|
|
13
|
-
if (repositoryUrl !== void 0 && gitInfo?.type !== "github") {
|
|
14
|
-
throw new Error("Only GitHub repositories are supported.");
|
|
15
|
-
}
|
|
2
|
+
export default packageConfig => {
|
|
16
3
|
const packageName = parsePackagejsonName(packageConfig.name).fullName;
|
|
17
4
|
return {
|
|
18
5
|
apps: [{
|
|
19
|
-
args: "
|
|
6
|
+
args: "-- node .output/server/index.mjs",
|
|
20
7
|
exec_mode: "cluster",
|
|
21
8
|
instances: "max",
|
|
22
9
|
name: packageName,
|
|
23
|
-
script: "
|
|
24
|
-
}]
|
|
25
|
-
deploy: {
|
|
26
|
-
production: {
|
|
27
|
-
host: ["sebastianlandwehr.com"],
|
|
28
|
-
path: `/var/www/${packageName}`,
|
|
29
|
-
"post-deploy": "source ~/.nvm/nvm.sh && pnpm install --frozen-lockfile && pnpm checkUnknownFiles && pnpm build && pm2 startOrReload ecosystem.json",
|
|
30
|
-
...(gitInfo && {
|
|
31
|
-
repo: `git@github.com:${gitInfo.user}/${gitInfo.project}.git`
|
|
32
|
-
}),
|
|
33
|
-
ref: "origin/master",
|
|
34
|
-
user: "root"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
10
|
+
script: "dotenv-json-extended"
|
|
11
|
+
}]
|
|
37
12
|
};
|
|
38
13
|
};
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,6 @@ import dockerCompose from "./docker-compose.js";
|
|
|
12
12
|
import getEcosystemConfig from "./get-ecosystem-config.js";
|
|
13
13
|
import getNginxConfig from "./get-nginx-config.js";
|
|
14
14
|
const resolver = createRequire(import.meta.url);
|
|
15
|
-
const requirementsYml = fs.readFileSync(resolver.resolve("./requirements.yml"), "utf8");
|
|
16
|
-
const playbookYml = fs.readFileSync(resolver.resolve("./playbook.yml"), "utf8");
|
|
17
15
|
export default defineBaseConfig(function (config) {
|
|
18
16
|
const packageConfig = readPackageSync({
|
|
19
17
|
cwd: this.cwd
|
|
@@ -21,8 +19,8 @@ export default defineBaseConfig(function (config) {
|
|
|
21
19
|
const baseConfigNuxt = getBaseConfigNuxt.call(this, config);
|
|
22
20
|
return {
|
|
23
21
|
...baseConfigNuxt,
|
|
24
|
-
allowedMatches: [...baseConfigNuxt.allowedMatches, "docker-compose.yml", "ecosystem.json", "nginx", "playbook.yml", "requirements.yml"],
|
|
25
|
-
editorIgnore: [...baseConfigNuxt.editorIgnore, "docker-compose.yml", "ecosystem.json", "nginx", "playbook.yml", "requirements.yml"],
|
|
22
|
+
allowedMatches: [...baseConfigNuxt.allowedMatches, "docker-compose.yml", "ecosystem.json", "nginx", ...(packageConfig.private ? [] : ["playbook.yml", "requirements.yml"])],
|
|
23
|
+
editorIgnore: [...baseConfigNuxt.editorIgnore, "docker-compose.yml", "ecosystem.json", "nginx", ...(packageConfig.private ? [] : ["playbook.yml", "requirements.yml"])],
|
|
26
24
|
eslintConfig: getEslintConfig({
|
|
27
25
|
ignore: ["ecosystem.json"],
|
|
28
26
|
virtualImports: config.virtualImports
|
|
@@ -34,12 +32,15 @@ export default defineBaseConfig(function (config) {
|
|
|
34
32
|
await baseConfigNuxt.prepare();
|
|
35
33
|
return outputFiles(this.cwd, {
|
|
36
34
|
"docker-compose.yml": yaml.stringify(dockerCompose),
|
|
37
|
-
"ecosystem.json": JSON.stringify(getEcosystemConfig(packageConfig,
|
|
38
|
-
cwd: this.cwd
|
|
39
|
-
}), void 0, 2),
|
|
35
|
+
"ecosystem.json": JSON.stringify(getEcosystemConfig(packageConfig), void 0, 2),
|
|
40
36
|
"nginx/default.config": getNginxConfig(packageConfig),
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
...(!packageConfig.private && (await (async () => {
|
|
38
|
+
const [playbookYml, requirementsYml] = await Promise.all([fs.readFile(resolver.resolve("./playbook.yml"), "utf8"), fs.readFile(resolver.resolve("./requirements.yml"), "utf8")]);
|
|
39
|
+
return {
|
|
40
|
+
"playbook.yml": playbookYml,
|
|
41
|
+
"requirements.yml": requirementsYml
|
|
42
|
+
};
|
|
43
|
+
})()))
|
|
43
44
|
});
|
|
44
45
|
},
|
|
45
46
|
renovateConfig: {
|
|
@@ -54,7 +55,7 @@ export default defineBaseConfig(function (config) {
|
|
|
54
55
|
run: "pnpm build"
|
|
55
56
|
}, {
|
|
56
57
|
name: "Create deploy artifact",
|
|
57
|
-
run: "tar -czf deploy.tgz .output"
|
|
58
|
+
run: "tar -czf deploy.tgz .output ecosystem.json"
|
|
58
59
|
}, {
|
|
59
60
|
name: "Install Python",
|
|
60
61
|
uses: "actions/setup-python@v4",
|
|
@@ -101,12 +102,6 @@ export default defineBaseConfig(function (config) {
|
|
|
101
102
|
cwd: this.cwd,
|
|
102
103
|
stdio: "inherit"
|
|
103
104
|
})
|
|
104
|
-
},
|
|
105
|
-
setupDeploy: {
|
|
106
|
-
handler: () => execaCommand(`${packageName`pm2`} deploy production setup`, {
|
|
107
|
-
cwd: this.cwd,
|
|
108
|
-
stdio: "inherit"
|
|
109
|
-
})
|
|
110
105
|
}
|
|
111
106
|
}
|
|
112
107
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dword-design/base-config-app",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.3",
|
|
4
4
|
"repository": "dword-design/base-config-app",
|
|
5
5
|
"funding": "https://github.com/sponsors/dword-design",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,11 +37,8 @@
|
|
|
37
37
|
"endent": "npm:@dword-design/endent@^1.4.7",
|
|
38
38
|
"execa": "^9.6.1",
|
|
39
39
|
"fs-extra": "^11.3.2",
|
|
40
|
-
"hosted-git-info": "^9.0.2",
|
|
41
40
|
"output-files": "^3.0.0",
|
|
42
|
-
"parse-git-config": "npm:@dword-design/parse-git-config@^0.0.1",
|
|
43
41
|
"parse-packagejson-name": "npm:@dword-design/parse-packagejson-name-fork@^0.0.2",
|
|
44
|
-
"pm2": "^6.0.14",
|
|
45
42
|
"read-pkg": "^10.0.0",
|
|
46
43
|
"tagged-template-noop": "^2.1.1",
|
|
47
44
|
"yaml": "^2.8.2"
|
|
@@ -50,8 +47,6 @@
|
|
|
50
47
|
"@playwright/browser-chromium": "^1.57.0",
|
|
51
48
|
"@playwright/test": "^1.57.0",
|
|
52
49
|
"@types/fs-extra": "^11.0.4",
|
|
53
|
-
"@types/hosted-git-info": "^3.0.5",
|
|
54
|
-
"@types/parse-git-config": "^3.0.4",
|
|
55
50
|
"get-port": "^7.1.0",
|
|
56
51
|
"nuxt-dev-ready": "^5.0.1",
|
|
57
52
|
"tree-kill-promise": "^4.0.0"
|