@backstage/plugin-scaffolder-backend-module-rails 0.5.10-next.0 → 0.5.10-next.2
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend-module-rails
|
|
2
2
|
|
|
3
|
+
## 0.5.10-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a579693: Migrate to new actions format
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-scaffolder-node@0.9.0-next.2
|
|
10
|
+
- @backstage/backend-plugin-api@1.4.0-next.1
|
|
11
|
+
- @backstage/config@1.3.2
|
|
12
|
+
- @backstage/errors@1.2.7
|
|
13
|
+
- @backstage/integration@1.17.0
|
|
14
|
+
- @backstage/types@1.2.1
|
|
15
|
+
|
|
16
|
+
## 0.5.10-next.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @backstage/plugin-scaffolder-node@0.8.3-next.1
|
|
22
|
+
- @backstage/backend-plugin-api@1.4.0-next.1
|
|
23
|
+
- @backstage/config@1.3.2
|
|
24
|
+
- @backstage/errors@1.2.7
|
|
25
|
+
- @backstage/integration@1.17.0
|
|
26
|
+
- @backstage/types@1.2.1
|
|
27
|
+
|
|
3
28
|
## 0.5.10-next.0
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -20,132 +20,80 @@ function createFetchRailsAction(options) {
|
|
|
20
20
|
examples: index_examples.examples,
|
|
21
21
|
schema: {
|
|
22
22
|
input: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
title: "skipActionText",
|
|
88
|
-
description: "Skip Action Text gem",
|
|
89
|
-
type: "boolean"
|
|
90
|
-
},
|
|
91
|
-
skipActiveRecord: {
|
|
92
|
-
title: "skipActiveRecord",
|
|
93
|
-
description: "Skip Active Record files",
|
|
94
|
-
type: "boolean"
|
|
95
|
-
},
|
|
96
|
-
force: {
|
|
97
|
-
title: "force",
|
|
98
|
-
description: "Overwrite files that already exist",
|
|
99
|
-
type: "boolean"
|
|
100
|
-
},
|
|
101
|
-
api: {
|
|
102
|
-
title: "api",
|
|
103
|
-
description: "Preconfigure smaller stack for API only apps",
|
|
104
|
-
type: "boolean"
|
|
105
|
-
},
|
|
106
|
-
template: {
|
|
107
|
-
title: "template",
|
|
108
|
-
description: "Path to some application template (can be a filesystem path or URL)",
|
|
109
|
-
type: "string"
|
|
110
|
-
},
|
|
111
|
-
webpacker: {
|
|
112
|
-
title: "webpacker",
|
|
113
|
-
description: "Preconfigure Webpack with a particular framework (options: react, vue, angular, elm, stimulus)",
|
|
114
|
-
type: "string",
|
|
115
|
-
enum: ["react", "vue", "angular", "elm", "stimulus"]
|
|
116
|
-
},
|
|
117
|
-
database: {
|
|
118
|
-
title: "database",
|
|
119
|
-
description: "Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)",
|
|
120
|
-
type: "string",
|
|
121
|
-
enum: [
|
|
122
|
-
"mysql",
|
|
123
|
-
"postgresql",
|
|
124
|
-
"sqlite3",
|
|
125
|
-
"oracle",
|
|
126
|
-
"sqlserver",
|
|
127
|
-
"jdbcmysql",
|
|
128
|
-
"jdbcsqlite3",
|
|
129
|
-
"jdbcpostgresql",
|
|
130
|
-
"jdbc"
|
|
131
|
-
]
|
|
132
|
-
},
|
|
133
|
-
railsVersion: {
|
|
134
|
-
title: "Rails version in Gemfile",
|
|
135
|
-
description: "Set up the application with Gemfile pointing to a specific version (options: fromImage, dev, edge, master)",
|
|
136
|
-
type: "string",
|
|
137
|
-
enum: ["dev", "edge", "master", "fromImage"]
|
|
138
|
-
}
|
|
139
|
-
}
|
|
23
|
+
url: (z) => z.string({
|
|
24
|
+
description: "Relative path or absolute URL pointing to the directory tree to fetch"
|
|
25
|
+
}),
|
|
26
|
+
targetPath: (z) => z.string({
|
|
27
|
+
description: "Target path within the working directory to download the contents to."
|
|
28
|
+
}).optional(),
|
|
29
|
+
values: (z) => z.object({
|
|
30
|
+
railsArguments: z.object({
|
|
31
|
+
minimal: z.boolean({
|
|
32
|
+
description: "Preconfigure a minimal rails app"
|
|
33
|
+
}).optional(),
|
|
34
|
+
skipBundle: z.boolean({
|
|
35
|
+
description: "Don't run bundle install"
|
|
36
|
+
}).optional(),
|
|
37
|
+
skipWebpackInstall: z.boolean({
|
|
38
|
+
description: "Don't run Webpack install"
|
|
39
|
+
}).optional(),
|
|
40
|
+
skipTest: z.boolean({
|
|
41
|
+
description: "Skip test files"
|
|
42
|
+
}).optional(),
|
|
43
|
+
skipActionCable: z.boolean({
|
|
44
|
+
description: "Skip Action Cable files"
|
|
45
|
+
}).optional(),
|
|
46
|
+
skipActionMailer: z.boolean({
|
|
47
|
+
description: "Skip Action Mailer files"
|
|
48
|
+
}).optional(),
|
|
49
|
+
skipActionMailbox: z.boolean({
|
|
50
|
+
description: "Skip Action Mailbox gem"
|
|
51
|
+
}).optional(),
|
|
52
|
+
skipActiveStorage: z.boolean({
|
|
53
|
+
description: "Skip Active Storage files"
|
|
54
|
+
}).optional(),
|
|
55
|
+
skipActionText: z.boolean({
|
|
56
|
+
description: "Skip Action Text gem"
|
|
57
|
+
}).optional(),
|
|
58
|
+
skipActiveRecord: z.boolean({
|
|
59
|
+
description: "Skip Active Record files"
|
|
60
|
+
}).optional(),
|
|
61
|
+
force: z.boolean({
|
|
62
|
+
description: "Overwrite files that already exist"
|
|
63
|
+
}).optional(),
|
|
64
|
+
api: z.boolean({
|
|
65
|
+
description: "Preconfigure smaller stack for API only apps"
|
|
66
|
+
}).optional(),
|
|
67
|
+
template: z.string({
|
|
68
|
+
description: "Path to some application template (can be a filesystem path or URL)"
|
|
69
|
+
}).optional(),
|
|
70
|
+
webpacker: z.enum(["react", "vue", "angular", "elm", "stimulus"], {
|
|
71
|
+
description: "Preconfigure Webpack with a particular framework (options: react, vue, angular, elm, stimulus)"
|
|
72
|
+
}).optional(),
|
|
73
|
+
database: z.enum(
|
|
74
|
+
[
|
|
75
|
+
"mysql",
|
|
76
|
+
"postgresql",
|
|
77
|
+
"sqlite3",
|
|
78
|
+
"oracle",
|
|
79
|
+
"sqlserver",
|
|
80
|
+
"jdbcmysql",
|
|
81
|
+
"jdbcsqlite3",
|
|
82
|
+
"jdbcpostgresql",
|
|
83
|
+
"jdbc"
|
|
84
|
+
],
|
|
85
|
+
{
|
|
86
|
+
description: "Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)"
|
|
140
87
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
88
|
+
).optional(),
|
|
89
|
+
railsVersion: z.enum(["dev", "edge", "master", "fromImage"], {
|
|
90
|
+
description: "Set up the application with Gemfile pointing to a specific version (options: fromImage, dev, edge, master)"
|
|
91
|
+
}).optional()
|
|
92
|
+
}).optional()
|
|
93
|
+
}),
|
|
94
|
+
imageName: (z) => z.string({
|
|
95
|
+
description: "Specify a Docker image to run rails new. Used only when a local rails is not found."
|
|
96
|
+
}).optional()
|
|
149
97
|
}
|
|
150
98
|
},
|
|
151
99
|
async handler(ctx) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../../src/actions/fetch/rails/index.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject } from '@backstage/types';\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrations } from '@backstage/integration';\nimport fs from 'fs-extra';\nimport {\n createTemplateAction,\n fetchContents,\n} from '@backstage/plugin-scaffolder-node';\n\nimport { resolve as resolvePath } from 'path';\nimport { RailsNewRunner } from './railsNewRunner';\nimport { PassThrough } from 'stream';\nimport { examples } from './index.examples';\nimport { UrlReaderService } from '@backstage/backend-plugin-api';\nimport { ContainerRunner } from './ContainerRunner';\n\nexport { type ContainerRunner };\n\n/**\n * Creates the `fetch:rails` Scaffolder action.\n *\n * @remarks\n *\n * See {@link https://guides.rubyonrails.org/rails_application_templates.html} and {@link https://backstage.io/docs/features/software-templates/writing-custom-actions}.\n *\n * @param options - Configuration of the templater.\n * @public\n */\nexport function createFetchRailsAction(options: {\n reader: UrlReaderService;\n integrations: ScmIntegrations;\n containerRunner?: ContainerRunner;\n /** A list of image names that are allowed to be passed as imageName input */\n allowedImageNames?: string[];\n}) {\n const { reader, integrations, containerRunner } = options;\n\n return createTemplateAction<{\n url: string;\n targetPath?: string;\n values: JsonObject;\n imageName?: string;\n }>({\n id: 'fetch:rails',\n description:\n 'Downloads a template from the given `url` into the workspace, and runs a rails new generator on it.',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['url'],\n properties: {\n url: {\n title: 'Fetch URL',\n description:\n 'Relative path or absolute URL pointing to the directory tree to fetch',\n type: 'string',\n },\n targetPath: {\n title: 'Target Path',\n description:\n 'Target path within the working directory to download the contents to.',\n type: 'string',\n },\n values: {\n title: 'Template Values',\n description: 'Values to pass on to rails for templating',\n type: 'object',\n properties: {\n railsArguments: {\n title: 'Arguments to pass to new command',\n description:\n 'You can provide some arguments to create a custom app',\n type: 'object',\n properties: {\n minimal: {\n title: 'minimal',\n description: 'Preconfigure a minimal rails app',\n type: 'boolean',\n },\n skipBundle: {\n title: 'skipBundle',\n description: \"Don't run bundle install\",\n type: 'boolean',\n },\n skipWebpackInstall: {\n title: 'skipWebpackInstall',\n description: \"Don't run Webpack install\",\n type: 'boolean',\n },\n skipTest: {\n title: 'skipTest',\n description: 'Skip test files',\n type: 'boolean',\n },\n skipActionCable: {\n title: 'skipActionCable',\n description: 'Skip Action Cable files',\n type: 'boolean',\n },\n skipActionMailer: {\n title: 'skipActionMailer',\n description: 'Skip Action Mailer files',\n type: 'boolean',\n },\n skipActionMailbox: {\n title: 'skipActionMailbox',\n description: 'Skip Action Mailbox gem',\n type: 'boolean',\n },\n skipActiveStorage: {\n title: 'skipActiveStorage',\n description: 'Skip Active Storage files',\n type: 'boolean',\n },\n skipActionText: {\n title: 'skipActionText',\n description: 'Skip Action Text gem',\n type: 'boolean',\n },\n skipActiveRecord: {\n title: 'skipActiveRecord',\n description: 'Skip Active Record files',\n type: 'boolean',\n },\n\n force: {\n title: 'force',\n description: 'Overwrite files that already exist',\n type: 'boolean',\n },\n api: {\n title: 'api',\n description: 'Preconfigure smaller stack for API only apps',\n type: 'boolean',\n },\n template: {\n title: 'template',\n description:\n 'Path to some application template (can be a filesystem path or URL)',\n type: 'string',\n },\n webpacker: {\n title: 'webpacker',\n description:\n 'Preconfigure Webpack with a particular framework (options: react, vue, angular, elm, stimulus)',\n type: 'string',\n enum: ['react', 'vue', 'angular', 'elm', 'stimulus'],\n },\n database: {\n title: 'database',\n description:\n 'Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)',\n type: 'string',\n enum: [\n 'mysql',\n 'postgresql',\n 'sqlite3',\n 'oracle',\n 'sqlserver',\n 'jdbcmysql',\n 'jdbcsqlite3',\n 'jdbcpostgresql',\n 'jdbc',\n ],\n },\n railsVersion: {\n title: 'Rails version in Gemfile',\n description:\n 'Set up the application with Gemfile pointing to a specific version (options: fromImage, dev, edge, master)',\n type: 'string',\n enum: ['dev', 'edge', 'master', 'fromImage'],\n },\n },\n },\n },\n },\n imageName: {\n title: 'Rails Docker image',\n description:\n 'Specify a Docker image to run rails new. Used only when a local rails is not found.',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n ctx.logger.info('Fetching and then templating using rails');\n\n const workDir = await ctx.createTemporaryDirectory();\n const resultDir = resolvePath(workDir, 'result');\n\n await fetchContents({\n reader,\n integrations,\n baseUrl: ctx.templateInfo?.baseUrl,\n fetchUrl: ctx.input.url,\n outputPath: workDir,\n });\n\n const templateRunner = new RailsNewRunner({ containerRunner });\n\n const { imageName } = ctx.input;\n if (imageName && !options.allowedImageNames?.includes(imageName)) {\n throw new Error(`Image ${imageName} is not allowed`);\n }\n\n const logStream = new PassThrough();\n logStream.on('data', chunk => {\n ctx.logger.info(chunk.toString());\n });\n\n // Will execute the template in ./template and put the result in ./result\n await templateRunner.run({\n workspacePath: workDir,\n logStream,\n values: { ...ctx.input.values, imageName },\n });\n\n // Finally move the template result into the task workspace\n const targetPath = ctx.input.targetPath ?? './';\n const outputPath = resolvePath(ctx.workspacePath, targetPath);\n if (!outputPath.startsWith(ctx.workspacePath)) {\n throw new InputError(\n `Fetch action targetPath may not specify a path outside the working directory`,\n );\n }\n await fs.copy(resultDir, outputPath);\n },\n });\n}\n"],"names":["createTemplateAction","examples","resolvePath","fetchContents","RailsNewRunner","PassThrough","InputError","fs"],"mappings":";;;;;;;;;;;;;;AA4CO,SAAS,uBAAuB,OAMpC,EAAA;AACD,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAc,EAAA,eAAA,EAAoB,GAAA,OAAA;AAElD,EAAA,OAAOA,yCAKJ,CAAA;AAAA,IACD,EAAI,EAAA,aAAA;AAAA,IACJ,WACE,EAAA,qGAAA;AAAA,cACFC,uBAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAA,EAAU,CAAC,KAAK,CAAA;AAAA,QAChB,UAAY,EAAA;AAAA,UACV,GAAK,EAAA;AAAA,YACH,KAAO,EAAA,WAAA;AAAA,YACP,WACE,EAAA,uEAAA;AAAA,YACF,IAAM,EAAA;AAAA,WACR;AAAA,UACA,UAAY,EAAA;AAAA,YACV,KAAO,EAAA,aAAA;AAAA,YACP,WACE,EAAA,uEAAA;AAAA,YACF,IAAM,EAAA;AAAA,WACR;AAAA,UACA,MAAQ,EAAA;AAAA,YACN,KAAO,EAAA,iBAAA;AAAA,YACP,WAAa,EAAA,2CAAA;AAAA,YACb,IAAM,EAAA,QAAA;AAAA,YACN,UAAY,EAAA;AAAA,cACV,cAAgB,EAAA;AAAA,gBACd,KAAO,EAAA,kCAAA;AAAA,gBACP,WACE,EAAA,uDAAA;AAAA,gBACF,IAAM,EAAA,QAAA;AAAA,gBACN,UAAY,EAAA;AAAA,kBACV,OAA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AI,CAAA,aAAA,EAAe,UAAU,CAAA;AAC5D,MAAA,IAAI,CAAC,UAAA,CAAW,UAAW,CAAA,GAAA,CAAI,aAAa,CAAG,EAAA;AAC7C,QAAA,MAAM,IAAII,iBAAA;AAAA,UACR,CAAA,4EAAA;AAAA,SACF;AAAA;AAEF,MAAM,MAAAC,mBAAA,CAAG,IAAK,CAAA,SAAA,EAAW,UAAU,CAAA;AAAA;AACrC,GACD,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../src/actions/fetch/rails/index.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrations } from '@backstage/integration';\nimport fs from 'fs-extra';\nimport {\n createTemplateAction,\n fetchContents,\n} from '@backstage/plugin-scaffolder-node';\n\nimport { resolve as resolvePath } from 'path';\nimport { RailsNewRunner } from './railsNewRunner';\nimport { PassThrough } from 'stream';\nimport { examples } from './index.examples';\nimport { UrlReaderService } from '@backstage/backend-plugin-api';\nimport { ContainerRunner } from './ContainerRunner';\n\nexport { type ContainerRunner };\n\n/**\n * Creates the `fetch:rails` Scaffolder action.\n *\n * @remarks\n *\n * See {@link https://guides.rubyonrails.org/rails_application_templates.html} and {@link https://backstage.io/docs/features/software-templates/writing-custom-actions}.\n *\n * @param options - Configuration of the templater.\n * @public\n */\nexport function createFetchRailsAction(options: {\n reader: UrlReaderService;\n integrations: ScmIntegrations;\n containerRunner?: ContainerRunner;\n /** A list of image names that are allowed to be passed as imageName input */\n allowedImageNames?: string[];\n}) {\n const { reader, integrations, containerRunner } = options;\n\n return createTemplateAction({\n id: 'fetch:rails',\n description:\n 'Downloads a template from the given `url` into the workspace, and runs a rails new generator on it.',\n examples,\n schema: {\n input: {\n url: z =>\n z.string({\n description:\n 'Relative path or absolute URL pointing to the directory tree to fetch',\n }),\n targetPath: z =>\n z\n .string({\n description:\n 'Target path within the working directory to download the contents to.',\n })\n .optional(),\n values: z =>\n z.object({\n railsArguments: z\n .object({\n minimal: z\n .boolean({\n description: 'Preconfigure a minimal rails app',\n })\n .optional(),\n skipBundle: z\n .boolean({\n description: \"Don't run bundle install\",\n })\n .optional(),\n skipWebpackInstall: z\n .boolean({\n description: \"Don't run Webpack install\",\n })\n .optional(),\n skipTest: z\n .boolean({\n description: 'Skip test files',\n })\n .optional(),\n skipActionCable: z\n .boolean({\n description: 'Skip Action Cable files',\n })\n .optional(),\n skipActionMailer: z\n .boolean({\n description: 'Skip Action Mailer files',\n })\n .optional(),\n skipActionMailbox: z\n .boolean({\n description: 'Skip Action Mailbox gem',\n })\n .optional(),\n skipActiveStorage: z\n .boolean({\n description: 'Skip Active Storage files',\n })\n .optional(),\n skipActionText: z\n .boolean({\n description: 'Skip Action Text gem',\n })\n .optional(),\n skipActiveRecord: z\n .boolean({\n description: 'Skip Active Record files',\n })\n .optional(),\n force: z\n .boolean({\n description: 'Overwrite files that already exist',\n })\n .optional(),\n api: z\n .boolean({\n description: 'Preconfigure smaller stack for API only apps',\n })\n .optional(),\n template: z\n .string({\n description:\n 'Path to some application template (can be a filesystem path or URL)',\n })\n .optional(),\n webpacker: z\n .enum(['react', 'vue', 'angular', 'elm', 'stimulus'], {\n description:\n 'Preconfigure Webpack with a particular framework (options: react, vue, angular, elm, stimulus)',\n })\n .optional(),\n database: z\n .enum(\n [\n 'mysql',\n 'postgresql',\n 'sqlite3',\n 'oracle',\n 'sqlserver',\n 'jdbcmysql',\n 'jdbcsqlite3',\n 'jdbcpostgresql',\n 'jdbc',\n ],\n {\n description:\n 'Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)',\n },\n )\n .optional(),\n railsVersion: z\n .enum(['dev', 'edge', 'master', 'fromImage'], {\n description:\n 'Set up the application with Gemfile pointing to a specific version (options: fromImage, dev, edge, master)',\n })\n .optional(),\n })\n .optional(),\n }),\n imageName: z =>\n z\n .string({\n description:\n 'Specify a Docker image to run rails new. Used only when a local rails is not found.',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n ctx.logger.info('Fetching and then templating using rails');\n\n const workDir = await ctx.createTemporaryDirectory();\n const resultDir = resolvePath(workDir, 'result');\n\n await fetchContents({\n reader,\n integrations,\n baseUrl: ctx.templateInfo?.baseUrl,\n fetchUrl: ctx.input.url,\n outputPath: workDir,\n });\n\n const templateRunner = new RailsNewRunner({ containerRunner });\n\n const { imageName } = ctx.input;\n if (imageName && !options.allowedImageNames?.includes(imageName)) {\n throw new Error(`Image ${imageName} is not allowed`);\n }\n\n const logStream = new PassThrough();\n logStream.on('data', chunk => {\n ctx.logger.info(chunk.toString());\n });\n\n // Will execute the template in ./template and put the result in ./result\n await templateRunner.run({\n workspacePath: workDir,\n logStream,\n values: { ...ctx.input.values, imageName },\n });\n\n // Finally move the template result into the task workspace\n const targetPath = ctx.input.targetPath ?? './';\n const outputPath = resolvePath(ctx.workspacePath, targetPath);\n if (!outputPath.startsWith(ctx.workspacePath)) {\n throw new InputError(\n `Fetch action targetPath may not specify a path outside the working directory`,\n );\n }\n await fs.copy(resultDir, outputPath);\n },\n });\n}\n"],"names":["createTemplateAction","examples","resolvePath","fetchContents","RailsNewRunner","PassThrough","InputError","fs"],"mappings":";;;;;;;;;;;;;;AA2CO,SAAS,uBAAuB,OAMpC,EAAA;AACD,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAc,EAAA,eAAA,EAAoB,GAAA,OAAA;AAElD,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,aAAA;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AA,GAAA,CAAI,aAAa,CAAG,EAAA;AAC7C,QAAA,MAAM,IAAII,iBAAA;AAAA,UACR,CAAA,4EAAA;AAAA,SACF;AAAA;AAEF,MAAM,MAAAC,mBAAA,CAAG,IAAK,CAAA,SAAA,EAAW,UAAU,CAAA;AAAA;AACrC,GACD,CAAA;AACH;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as _backstage_plugin_scaffolder_node from '@backstage/plugin-scaffolder-node';
|
|
2
|
-
import { JsonObject } from '@backstage/types';
|
|
3
2
|
import { ScmIntegrations } from '@backstage/integration';
|
|
4
3
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
5
4
|
import { UrlReaderService } from '@backstage/backend-plugin-api';
|
|
@@ -56,10 +55,31 @@ declare function createFetchRailsAction(options: {
|
|
|
56
55
|
allowedImageNames?: string[];
|
|
57
56
|
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
58
57
|
url: string;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
values: {
|
|
59
|
+
railsArguments?: {
|
|
60
|
+
template?: string | undefined;
|
|
61
|
+
database?: "sqlite3" | "mysql" | "postgresql" | "oracle" | "sqlserver" | "jdbcmysql" | "jdbcsqlite3" | "jdbcpostgresql" | "jdbc" | undefined;
|
|
62
|
+
api?: boolean | undefined;
|
|
63
|
+
force?: boolean | undefined;
|
|
64
|
+
minimal?: boolean | undefined;
|
|
65
|
+
railsVersion?: "edge" | "master" | "dev" | "fromImage" | undefined;
|
|
66
|
+
skipActionCable?: boolean | undefined;
|
|
67
|
+
skipActionMailbox?: boolean | undefined;
|
|
68
|
+
skipActionMailer?: boolean | undefined;
|
|
69
|
+
skipActionText?: boolean | undefined;
|
|
70
|
+
skipActiveStorage?: boolean | undefined;
|
|
71
|
+
skipBundle?: boolean | undefined;
|
|
72
|
+
skipTest?: boolean | undefined;
|
|
73
|
+
skipWebpackInstall?: boolean | undefined;
|
|
74
|
+
skipActiveRecord?: boolean | undefined;
|
|
75
|
+
webpacker?: "react" | "angular" | "vue" | "elm" | "stimulus" | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
};
|
|
78
|
+
targetPath?: string | undefined;
|
|
79
|
+
imageName?: string | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
[x: string]: any;
|
|
82
|
+
}, "v2">;
|
|
63
83
|
|
|
64
84
|
/**
|
|
65
85
|
* @public
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend-module-rails",
|
|
3
|
-
"version": "0.5.10-next.
|
|
3
|
+
"version": "0.5.10-next.2",
|
|
4
4
|
"description": "A module for the scaffolder backend that lets you template projects using Rails",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -51,20 +51,20 @@
|
|
|
51
51
|
"test": "backstage-cli package test"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@backstage/backend-plugin-api": "1.4.0-next.
|
|
54
|
+
"@backstage/backend-plugin-api": "1.4.0-next.1",
|
|
55
55
|
"@backstage/config": "1.3.2",
|
|
56
56
|
"@backstage/errors": "1.2.7",
|
|
57
57
|
"@backstage/integration": "1.17.0",
|
|
58
|
-
"@backstage/plugin-scaffolder-node": "0.
|
|
58
|
+
"@backstage/plugin-scaffolder-node": "0.9.0-next.2",
|
|
59
59
|
"@backstage/types": "1.2.1",
|
|
60
60
|
"command-exists": "^1.2.9",
|
|
61
61
|
"fs-extra": "^11.0.0",
|
|
62
62
|
"yaml": "^2.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@backstage/backend-test-utils": "1.6.0-next.
|
|
66
|
-
"@backstage/cli": "0.
|
|
67
|
-
"@backstage/plugin-scaffolder-node-test-utils": "0.
|
|
65
|
+
"@backstage/backend-test-utils": "1.6.0-next.2",
|
|
66
|
+
"@backstage/cli": "0.33.0-next.1",
|
|
67
|
+
"@backstage/plugin-scaffolder-node-test-utils": "0.3.0-next.2",
|
|
68
68
|
"@types/command-exists": "^1.2.0",
|
|
69
69
|
"@types/fs-extra": "^11.0.0",
|
|
70
70
|
"@types/node": "^20.16.0",
|