create-platformatic 0.38.1 → 0.40.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-platformatic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "Create platformatic-db interactive tool",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"semver": "^7.5.1",
|
|
35
35
|
"undici": "^5.22.1",
|
|
36
36
|
"which": "^3.0.1",
|
|
37
|
-
"@platformatic/config": "0.
|
|
37
|
+
"@platformatic/config": "0.40.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"ajv": "^8.12.0",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"tap": "^16.3.6",
|
|
48
48
|
"typescript": "~5.2.0",
|
|
49
49
|
"yaml": "^2.3.1",
|
|
50
|
-
"@platformatic/db": "0.
|
|
51
|
-
"@platformatic/service": "0.
|
|
50
|
+
"@platformatic/db": "0.40.0",
|
|
51
|
+
"@platformatic/service": "0.40.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"test": "standard | snazzy && cross-env NODE_OPTIONS=\"--loader=esmock --no-warnings\" c8 tap --no-coverage test/*test.mjs test/*/*test.mjs",
|
package/src/db/create-db.mjs
CHANGED
package/src/ghaction.mjs
CHANGED
|
@@ -113,7 +113,7 @@ export const createDynamicWorkspaceGHAction = async (logger, env, config, projec
|
|
|
113
113
|
if (!isGithubActionExists) {
|
|
114
114
|
await mkdir(join(projectDir, '.github', 'workflows'), { recursive: true })
|
|
115
115
|
await writeFile(ghActionFilePath, dynamicWorkspaceGHTemplate(env, config, buildTS))
|
|
116
|
-
logger.info('Github action successfully created, please add the following secrets as repository secrets: ')
|
|
116
|
+
logger.info('PR Previews are enabled for your app and the Github action was successfully created, please add the following secrets as repository secrets: ')
|
|
117
117
|
const secretsString = formatSecretsToAdd({
|
|
118
118
|
PLATFORMATIC_DYNAMIC_WORKSPACE_ID: 'your workspace id',
|
|
119
119
|
PLATFORMATIC_DYNAMIC_WORKSPACE_API_KEY: 'your workspace API key',
|
|
@@ -135,7 +135,7 @@ export const askDynamicWorkspaceCreateGHAction = async (logger, env, type, build
|
|
|
135
135
|
{
|
|
136
136
|
type: 'list',
|
|
137
137
|
name: 'githubAction',
|
|
138
|
-
message: 'Do you want to
|
|
138
|
+
message: 'Do you want to enable PR Previews in your application?',
|
|
139
139
|
default: true,
|
|
140
140
|
choices: [{ name: 'yes', value: true }, { name: 'no', value: false }]
|
|
141
141
|
}
|
|
@@ -64,6 +64,7 @@ test('creates project with no typescript', async ({ equal }) => {
|
|
|
64
64
|
equal(server.hostname, '{PLT_SERVER_HOSTNAME}')
|
|
65
65
|
equal(server.port, '{PORT}')
|
|
66
66
|
equal(db.connectionString, '{DATABASE_URL}')
|
|
67
|
+
equal(db.schemalock, true)
|
|
67
68
|
|
|
68
69
|
const pathToDbEnvFile = join(tmpDir, '.env')
|
|
69
70
|
dotenv.config({ path: pathToDbEnvFile })
|
|
@@ -31,7 +31,7 @@ const env = {
|
|
|
31
31
|
|
|
32
32
|
test('creates gh action', async ({ equal, match }) => {
|
|
33
33
|
await createDynamicWorkspaceGHAction(fakeLogger, env, 'db', tmpDir, false)
|
|
34
|
-
equal(log[0], 'Github action successfully created, please add the following secrets as repository secrets: ')
|
|
34
|
+
equal(log[0], 'PR Previews are enabled for your app and the Github action was successfully created, please add the following secrets as repository secrets: ')
|
|
35
35
|
const accessible = await isFileAccessible(join(tmpDir, '.github/workflows/platformatic-dynamic-workspace-deploy.yml'))
|
|
36
36
|
equal(accessible, true)
|
|
37
37
|
const ghFile = await readFile(join(tmpDir, '.github/workflows/platformatic-dynamic-workspace-deploy.yml'), 'utf8')
|
|
@@ -50,7 +50,7 @@ test('creates gh action', async ({ equal, match }) => {
|
|
|
50
50
|
|
|
51
51
|
test('creates gh action with TS build step', async ({ equal, match }) => {
|
|
52
52
|
await createDynamicWorkspaceGHAction(fakeLogger, env, 'db', tmpDir, true)
|
|
53
|
-
equal(log[0], 'Github action successfully created, please add the following secrets as repository secrets: ')
|
|
53
|
+
equal(log[0], 'PR Previews are enabled for your app and the Github action was successfully created, please add the following secrets as repository secrets: ')
|
|
54
54
|
const accessible = await isFileAccessible(join(tmpDir, '.github/workflows/platformatic-dynamic-workspace-deploy.yml'))
|
|
55
55
|
equal(accessible, true)
|
|
56
56
|
const ghFile = await readFile(join(tmpDir, '.github/workflows/platformatic-dynamic-workspace-deploy.yml'), 'utf8')
|
|
@@ -78,7 +78,7 @@ test('do not create gitignore file because already present', async ({ end, equal
|
|
|
78
78
|
|
|
79
79
|
test('creates gh action with a warn if a .git folder is not present', async ({ end, equal }) => {
|
|
80
80
|
await createDynamicWorkspaceGHAction(fakeLogger, env, 'db', tmpDir)
|
|
81
|
-
equal(log[0], 'Github action successfully created, please add the following secrets as repository secrets: ')
|
|
81
|
+
equal(log[0], 'PR Previews are enabled for your app and the Github action was successfully created, please add the following secrets as repository secrets: ')
|
|
82
82
|
const accessible = await isFileAccessible(join(tmpDir, '.github/workflows/platformatic-dynamic-workspace-deploy.yml'))
|
|
83
83
|
equal(accessible, true)
|
|
84
84
|
const secretsLogLine = log[1].split('\n')
|
|
@@ -91,7 +91,7 @@ test('creates gh action with a warn if a .git folder is not present', async ({ e
|
|
|
91
91
|
test('creates gh action without a warn if a .git folder is present', async ({ end, equal }) => {
|
|
92
92
|
await mkdir(join(tmpDir, '.git'), { recursive: true })
|
|
93
93
|
await createDynamicWorkspaceGHAction(fakeLogger, env, 'db', tmpDir)
|
|
94
|
-
equal(log[0], 'Github action successfully created, please add the following secrets as repository secrets: ')
|
|
94
|
+
equal(log[0], 'PR Previews are enabled for your app and the Github action was successfully created, please add the following secrets as repository secrets: ')
|
|
95
95
|
const accessible = await isFileAccessible(join(tmpDir, '.github/workflows/platformatic-dynamic-workspace-deploy.yml'))
|
|
96
96
|
equal(accessible, true)
|
|
97
97
|
equal(log.length, 2)
|
package/test/utils.test.mjs
CHANGED
|
@@ -6,7 +6,12 @@ import { join } from 'path'
|
|
|
6
6
|
import esmock from 'esmock'
|
|
7
7
|
import semver from 'semver'
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// esmock is broken on Node v20.6.0+
|
|
10
|
+
// Resolve once https://github.com/iambumblehead/esmock/issues/234 is fixed.
|
|
11
|
+
|
|
12
|
+
const skip = semver.gte(process.version, '20.6.0')
|
|
13
|
+
|
|
14
|
+
test('getUsername from git', { skip }, async ({ end, equal }) => {
|
|
10
15
|
const name = 'lukeskywalker'
|
|
11
16
|
const { getUsername } = await esmock.strict('../src/utils.mjs', {
|
|
12
17
|
execa: {
|
|
@@ -22,7 +27,7 @@ test('getUsername from git', async ({ end, equal }) => {
|
|
|
22
27
|
equal(username, name)
|
|
23
28
|
})
|
|
24
29
|
|
|
25
|
-
test('getUsername from whoami', async ({ end, equal }) => {
|
|
30
|
+
test('getUsername from whoami', { skip }, async ({ end, equal }) => {
|
|
26
31
|
const name = 'hansolo'
|
|
27
32
|
const { getUsername } = await esmock.strict('../src/utils.mjs', {
|
|
28
33
|
execa: {
|
|
@@ -38,7 +43,7 @@ test('getUsername from whoami', async ({ end, equal }) => {
|
|
|
38
43
|
equal(username, name)
|
|
39
44
|
})
|
|
40
45
|
|
|
41
|
-
test('if getUsername from git failed, it tries whoim', async ({ end, equal }) => {
|
|
46
|
+
test('if getUsername from git failed, it tries whoim', { skip }, async ({ end, equal }) => {
|
|
42
47
|
const name = 'lukeskywalker'
|
|
43
48
|
|
|
44
49
|
const { getUsername } = await esmock.strict('../src/utils.mjs', {
|
|
@@ -59,7 +64,7 @@ test('if getUsername from git failed, it tries whoim', async ({ end, equal }) =>
|
|
|
59
64
|
equal(username, name)
|
|
60
65
|
})
|
|
61
66
|
|
|
62
|
-
test('if both git usern.ame and whoami fail, no username is set', async ({ end, equal }) => {
|
|
67
|
+
test('if both git usern.ame and whoami fail, no username is set', { skip }, async ({ end, equal }) => {
|
|
63
68
|
const { getUsername } = await esmock.strict('../src/utils.mjs', {
|
|
64
69
|
execa: {
|
|
65
70
|
execa: (command) => {
|
|
@@ -77,7 +82,7 @@ test('if both git usern.ame and whoami fail, no username is set', async ({ end,
|
|
|
77
82
|
equal(username, null)
|
|
78
83
|
})
|
|
79
84
|
|
|
80
|
-
test('getUsername - no username found', async ({ end, equal }) => {
|
|
85
|
+
test('getUsername - no username found', { skip }, async ({ end, equal }) => {
|
|
81
86
|
const { getUsername } = await esmock.strict('../src/utils.mjs', {
|
|
82
87
|
execa: {
|
|
83
88
|
execa: (command) => {
|