create-nexora-next 0.3.7 → 0.4.8
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/README.md +228 -46
- package/package.json +46 -46
- package/src/index.js +241 -266
- package/src/steps/01-create-next-app.js +18 -18
- package/src/steps/02-shadcn.js +38 -38
- package/src/steps/03-base-files.js +106 -109
- package/src/steps/04-providers.js +51 -51
- package/src/steps/05-i18n.js +41 -41
- package/src/steps/06-auth.js +30 -30
- package/src/steps/07-proxy.js +16 -16
- package/src/steps/08-install-deps.js +82 -82
- package/src/steps/09-husky.js +58 -58
- package/src/steps/10-axios.js +14 -14
- package/src/steps/11-patch-pkg.js +21 -21
- package/src/templates/files.js +900 -908
- package/src/utils/args.js +119 -0
- package/src/utils/runner.js +49 -49
- package/src/utils/safe-step.js +42 -42
- package/src/utils/writer.js +37 -37
|
@@ -1,110 +1,107 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @param {
|
|
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
|
-
// src/components/
|
|
60
|
-
writeFile(p('src', 'components', '
|
|
61
|
-
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
['src', '
|
|
68
|
-
['src', 'components', '
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
writeFile(p('src', 'app', '
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const p = (...parts) => path.join(targetDir, ...parts)
|
|
108
|
-
writeFile(p('src', 'app', 'sitemap.ts'), sitemapTs)
|
|
109
|
-
})
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import {
|
|
4
|
+
constantsTs,
|
|
5
|
+
envLocal,
|
|
6
|
+
eslintConfigMjs,
|
|
7
|
+
fontsTs,
|
|
8
|
+
localeLayoutTs,
|
|
9
|
+
nuqsAdapterTsx,
|
|
10
|
+
prettierRc,
|
|
11
|
+
rootLayoutI18nTs,
|
|
12
|
+
rootLayoutTs,
|
|
13
|
+
seoTs,
|
|
14
|
+
seoWithLocaleTs,
|
|
15
|
+
sileoUiTsx,
|
|
16
|
+
sitemapTs,
|
|
17
|
+
utilsTs,
|
|
18
|
+
utilsWithAxiosTs
|
|
19
|
+
} from '../templates/files.js'
|
|
20
|
+
import { safeStep } from '../utils/safe-step.js'
|
|
21
|
+
import { mkdir, writeFile } from '../utils/writer.js'
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} targetDir
|
|
25
|
+
* @param {{ i18n: boolean, axios: boolean, query: boolean }} opts
|
|
26
|
+
*/
|
|
27
|
+
export async function stepWriteBaseFiles(targetDir, opts) {
|
|
28
|
+
await safeStep('Writing base config files', () => {
|
|
29
|
+
const p = (...parts) => path.join(targetDir, ...parts)
|
|
30
|
+
|
|
31
|
+
// .env.local
|
|
32
|
+
writeFile(p('.env.local'), envLocal)
|
|
33
|
+
|
|
34
|
+
// .prettierrc
|
|
35
|
+
writeFile(p('.prettierrc'), prettierRc)
|
|
36
|
+
|
|
37
|
+
// src/lib/fonts.ts
|
|
38
|
+
writeFile(p('src', 'lib', 'fonts.ts'), fontsTs)
|
|
39
|
+
|
|
40
|
+
// src/lib/utils/index.ts
|
|
41
|
+
writeFile(
|
|
42
|
+
p('src', 'lib', 'utils', 'index.ts'),
|
|
43
|
+
opts.axios ? utilsWithAxiosTs : utilsTs,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
// src/constants/index.ts
|
|
47
|
+
writeFile(p('src', 'constants', 'index.ts'), constantsTs(opts))
|
|
48
|
+
|
|
49
|
+
// src/lib/seo/index.ts
|
|
50
|
+
writeFile(
|
|
51
|
+
p('src', 'lib', 'seo', 'index.ts'),
|
|
52
|
+
opts.i18n ? seoWithLocaleTs : seoTs,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
// src/components/ui/sileo.tsx
|
|
56
|
+
writeFile(p('src', 'components', 'ui', 'sileo.tsx'), sileoUiTsx)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// src/components/adapters/nuqs.adapter.tsx
|
|
60
|
+
writeFile(p('src', 'components', 'adapters', 'nuqs.adapter.tsx'), nuqsAdapterTsx)
|
|
61
|
+
|
|
62
|
+
// Empty structural folders
|
|
63
|
+
const emptyDirs = [
|
|
64
|
+
['src', 'hooks'],
|
|
65
|
+
['src', 'components', 'atoms'],
|
|
66
|
+
['src', 'components', 'molecules'],
|
|
67
|
+
['src', 'components', 'organisms'],
|
|
68
|
+
['src', 'components', 'primitives'],
|
|
69
|
+
]
|
|
70
|
+
for (const parts of emptyDirs) {
|
|
71
|
+
mkdir(p(...parts))
|
|
72
|
+
writeFile(p(...parts, 'index.ts'), `// ${parts[parts.length - 1]}\n`)
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
// ── Layouts ────────────────────────────────────────────────────────────────
|
|
77
|
+
await safeStep('Setting up app layouts', () => {
|
|
78
|
+
const p = (...parts) => path.join(targetDir, ...parts)
|
|
79
|
+
|
|
80
|
+
if (opts.i18n) {
|
|
81
|
+
// Replace root layout with passthrough shell
|
|
82
|
+
writeFile(p('src', 'app', 'layout.tsx'), rootLayoutI18nTs)
|
|
83
|
+
|
|
84
|
+
// Remove the default src/app/page.tsx (locale takes over routing)
|
|
85
|
+
const defaultPage = p('src', 'app', 'page.tsx')
|
|
86
|
+
if (fs.existsSync(defaultPage)) fs.unlinkSync(defaultPage)
|
|
87
|
+
|
|
88
|
+
// Create src/app/[locale]/layout.tsx
|
|
89
|
+
writeFile(p('src', 'app', '[locale]', 'layout.tsx'), localeLayoutTs)
|
|
90
|
+
} else {
|
|
91
|
+
// Standard root layout wiring up Providers
|
|
92
|
+
writeFile(p('src', 'app', 'layout.tsx'), rootLayoutTs)
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
// ── ESLint config ──────────────────────────────────────────────────────────
|
|
97
|
+
await safeStep('Replacing ESLint config', () => {
|
|
98
|
+
const p = (...parts) => path.join(targetDir, ...parts)
|
|
99
|
+
writeFile(p('eslint.config.mjs'), eslintConfigMjs(opts))
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
// ── Sitemap ────────────────────────────────────────────────────────────────
|
|
103
|
+
await safeStep('Writing sitemap', () => {
|
|
104
|
+
const p = (...parts) => path.join(targetDir, ...parts)
|
|
105
|
+
writeFile(p('src', 'app', 'sitemap.ts'), sitemapTs)
|
|
106
|
+
})
|
|
110
107
|
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import {
|
|
3
|
-
localeProviderTsx,
|
|
4
|
-
providersIndexTsx,
|
|
5
|
-
queryClientProviderTsx,
|
|
6
|
-
themeProviderTsx,
|
|
7
|
-
tzProviderTsx,
|
|
8
|
-
} from "../templates/files.js";
|
|
9
|
-
import { safeStep } from "../utils/safe-step.js";
|
|
10
|
-
import { writeFile } from "../utils/writer.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param {string} targetDir
|
|
14
|
-
* @param {{ i18n: boolean, theming: boolean, query: boolean }} opts
|
|
15
|
-
*/
|
|
16
|
-
export async function stepWriteProviders(targetDir, opts) {
|
|
17
|
-
await safeStep("Generating providers", () => {
|
|
18
|
-
const p = (...parts) => path.join(targetDir, ...parts);
|
|
19
|
-
|
|
20
|
-
// Dynamic providers/index.
|
|
21
|
-
writeFile(
|
|
22
|
-
p("src", "components", "providers", "index.tsx"),
|
|
23
|
-
providersIndexTsx(opts),
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
if (opts.theming) {
|
|
27
|
-
writeFile(
|
|
28
|
-
p("src", "components", "providers", "theme.provider.tsx"),
|
|
29
|
-
themeProviderTsx,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (opts.i18n) {
|
|
34
|
-
writeFile(
|
|
35
|
-
p("src", "components", "providers", "locale.provider.tsx"),
|
|
36
|
-
localeProviderTsx,
|
|
37
|
-
);
|
|
38
|
-
writeFile(
|
|
39
|
-
p("src", "components", "providers", "tz.provider.tsx"),
|
|
40
|
-
tzProviderTsx,
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (opts.query) {
|
|
45
|
-
writeFile(
|
|
46
|
-
p("src", "components", "providers", "query-client.provider.tsx"),
|
|
47
|
-
queryClientProviderTsx,
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
1
|
+
import path from "path";
|
|
2
|
+
import {
|
|
3
|
+
localeProviderTsx,
|
|
4
|
+
providersIndexTsx,
|
|
5
|
+
queryClientProviderTsx,
|
|
6
|
+
themeProviderTsx,
|
|
7
|
+
tzProviderTsx,
|
|
8
|
+
} from "../templates/files.js";
|
|
9
|
+
import { safeStep } from "../utils/safe-step.js";
|
|
10
|
+
import { writeFile } from "../utils/writer.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} targetDir
|
|
14
|
+
* @param {{ i18n: boolean, theming: boolean, query: boolean }} opts
|
|
15
|
+
*/
|
|
16
|
+
export async function stepWriteProviders(targetDir, opts) {
|
|
17
|
+
await safeStep("Generating providers", () => {
|
|
18
|
+
const p = (...parts) => path.join(targetDir, ...parts);
|
|
19
|
+
|
|
20
|
+
// Dynamic providers/index.tsx
|
|
21
|
+
writeFile(
|
|
22
|
+
p("src", "components", "providers", "index.tsx"),
|
|
23
|
+
providersIndexTsx(opts),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (opts.theming) {
|
|
27
|
+
writeFile(
|
|
28
|
+
p("src", "components", "providers", "theme.provider.tsx"),
|
|
29
|
+
themeProviderTsx,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (opts.i18n) {
|
|
34
|
+
writeFile(
|
|
35
|
+
p("src", "components", "providers", "locale.provider.tsx"),
|
|
36
|
+
localeProviderTsx,
|
|
37
|
+
);
|
|
38
|
+
writeFile(
|
|
39
|
+
p("src", "components", "providers", "tz.provider.tsx"),
|
|
40
|
+
tzProviderTsx,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (opts.query) {
|
|
45
|
+
writeFile(
|
|
46
|
+
p("src", "components", "providers", "query-client.provider.tsx"),
|
|
47
|
+
queryClientProviderTsx,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
package/src/steps/05-i18n.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import { writeFile } from '../utils/writer.js'
|
|
3
|
-
import { run, installCmd } from '../utils/runner.js'
|
|
4
|
-
import { safeStep } from '../utils/safe-step.js'
|
|
5
|
-
import {
|
|
6
|
-
i18nRoutingTs,
|
|
7
|
-
i18nRequestTs,
|
|
8
|
-
i18nNavigationTs,
|
|
9
|
-
nextIntlTs,
|
|
10
|
-
localesEnJson,
|
|
11
|
-
localPageTsx,
|
|
12
|
-
localeDateFormatsTs,
|
|
13
|
-
nextConfigI18nTs,
|
|
14
|
-
} from '../templates/files.js'
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param {string} targetDir
|
|
18
|
-
* @param {'npm'|'pnpm'|'bun'|'yarn'} pm
|
|
19
|
-
* @param {{ reactCompiler: boolean }} opts
|
|
20
|
-
*/
|
|
21
|
-
export async function stepSetupI18n(targetDir, pm, opts) {
|
|
22
|
-
await safeStep('Installing next-intl', () => {
|
|
23
|
-
run(installCmd(pm, ['next-intl']), targetDir)
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
await safeStep('Writing i18n files', () => {
|
|
27
|
-
const p = (...parts) => path.join(targetDir, ...parts)
|
|
28
|
-
|
|
29
|
-
writeFile(p('locales', 'en.json'), localesEnJson)
|
|
30
|
-
writeFile(p('src', 'i18n', 'routing.ts'), i18nRoutingTs)
|
|
31
|
-
writeFile(p('src', 'i18n', 'request.ts'), i18nRequestTs)
|
|
32
|
-
writeFile(p('src', 'i18n', 'navigation.ts'), i18nNavigationTs)
|
|
33
|
-
writeFile(p('next-intl.ts'), nextIntlTs)
|
|
34
|
-
writeFile(p('src', 'app', '[locale]', 'page.tsx'), localPageTsx)
|
|
35
|
-
writeFile(p('src', 'lib', 'utils', 'locale-date-formats.ts'), localeDateFormatsTs)
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
await safeStep('Updating next.config.ts for next-intl', () => {
|
|
39
|
-
const p = (...parts) => path.join(targetDir, ...parts)
|
|
40
|
-
writeFile(p('next.config.ts'), nextConfigI18nTs(opts))
|
|
41
|
-
})
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { writeFile } from '../utils/writer.js'
|
|
3
|
+
import { run, installCmd } from '../utils/runner.js'
|
|
4
|
+
import { safeStep } from '../utils/safe-step.js'
|
|
5
|
+
import {
|
|
6
|
+
i18nRoutingTs,
|
|
7
|
+
i18nRequestTs,
|
|
8
|
+
i18nNavigationTs,
|
|
9
|
+
nextIntlTs,
|
|
10
|
+
localesEnJson,
|
|
11
|
+
localPageTsx,
|
|
12
|
+
localeDateFormatsTs,
|
|
13
|
+
nextConfigI18nTs,
|
|
14
|
+
} from '../templates/files.js'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} targetDir
|
|
18
|
+
* @param {'npm'|'pnpm'|'bun'|'yarn'} pm
|
|
19
|
+
* @param {{ reactCompiler: boolean }} opts
|
|
20
|
+
*/
|
|
21
|
+
export async function stepSetupI18n(targetDir, pm, opts) {
|
|
22
|
+
await safeStep('Installing next-intl', () => {
|
|
23
|
+
run(installCmd(pm, ['next-intl']), targetDir)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
await safeStep('Writing i18n files', () => {
|
|
27
|
+
const p = (...parts) => path.join(targetDir, ...parts)
|
|
28
|
+
|
|
29
|
+
writeFile(p('locales', 'en.json'), localesEnJson)
|
|
30
|
+
writeFile(p('src', 'i18n', 'routing.ts'), i18nRoutingTs)
|
|
31
|
+
writeFile(p('src', 'i18n', 'request.ts'), i18nRequestTs)
|
|
32
|
+
writeFile(p('src', 'i18n', 'navigation.ts'), i18nNavigationTs)
|
|
33
|
+
writeFile(p('next-intl.ts'), nextIntlTs)
|
|
34
|
+
writeFile(p('src', 'app', '[locale]', 'page.tsx'), localPageTsx)
|
|
35
|
+
writeFile(p('src', 'lib', 'utils', 'locale-date-formats.ts'), localeDateFormatsTs)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
await safeStep('Updating next.config.ts for next-intl', () => {
|
|
39
|
+
const p = (...parts) => path.join(targetDir, ...parts)
|
|
40
|
+
writeFile(p('next.config.ts'), nextConfigI18nTs(opts))
|
|
41
|
+
})
|
|
42
42
|
}
|
package/src/steps/06-auth.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import { writeFile } from '../utils/writer.js'
|
|
3
|
-
import { safeStep } from '../utils/safe-step.js'
|
|
4
|
-
import {
|
|
5
|
-
proxyLibTs,
|
|
6
|
-
proxyAuthTs,
|
|
7
|
-
validatorsAuthTs,
|
|
8
|
-
validatorsTs,
|
|
9
|
-
apisClientTs,
|
|
10
|
-
apisServerTs,
|
|
11
|
-
} from '../templates/files.js'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @param {string} targetDir
|
|
15
|
-
* @param {{ i18n: boolean, auth: boolean, axios: boolean }} opts
|
|
16
|
-
*/
|
|
17
|
-
export async function stepSetupAuth(targetDir, opts) {
|
|
18
|
-
await safeStep('Writing auth & proxy files', () => {
|
|
19
|
-
const p = (...parts) => path.join(targetDir, ...parts)
|
|
20
|
-
|
|
21
|
-
writeFile(p('src', 'lib', 'proxy', 'index.ts'), proxyLibTs)
|
|
22
|
-
|
|
23
|
-
if (opts.auth) {
|
|
24
|
-
writeFile(p('src', 'lib', 'proxy', 'auth.ts'), proxyAuthTs)
|
|
25
|
-
writeFile(p('src', 'lib', 'validators', 'index.ts'), validatorsTs)
|
|
26
|
-
writeFile(p('src', 'lib', 'validators', 'auth.ts'), validatorsAuthTs)
|
|
27
|
-
writeFile(p('src', 'apis', 'client', 'index.ts'), apisClientTs)
|
|
28
|
-
writeFile(p('src', 'apis', 'server', 'index.ts'), apisServerTs)
|
|
29
|
-
}
|
|
30
|
-
})
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { writeFile } from '../utils/writer.js'
|
|
3
|
+
import { safeStep } from '../utils/safe-step.js'
|
|
4
|
+
import {
|
|
5
|
+
proxyLibTs,
|
|
6
|
+
proxyAuthTs,
|
|
7
|
+
validatorsAuthTs,
|
|
8
|
+
validatorsTs,
|
|
9
|
+
apisClientTs,
|
|
10
|
+
apisServerTs,
|
|
11
|
+
} from '../templates/files.js'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} targetDir
|
|
15
|
+
* @param {{ i18n: boolean, auth: boolean, axios: boolean }} opts
|
|
16
|
+
*/
|
|
17
|
+
export async function stepSetupAuth(targetDir, opts) {
|
|
18
|
+
await safeStep('Writing auth & proxy files', () => {
|
|
19
|
+
const p = (...parts) => path.join(targetDir, ...parts)
|
|
20
|
+
|
|
21
|
+
writeFile(p('src', 'lib', 'proxy', 'index.ts'), proxyLibTs)
|
|
22
|
+
|
|
23
|
+
if (opts.auth) {
|
|
24
|
+
writeFile(p('src', 'lib', 'proxy', 'auth.ts'), proxyAuthTs)
|
|
25
|
+
writeFile(p('src', 'lib', 'validators', 'index.ts'), validatorsTs)
|
|
26
|
+
writeFile(p('src', 'lib', 'validators', 'auth.ts'), validatorsAuthTs)
|
|
27
|
+
writeFile(p('src', 'apis', 'client', 'index.ts'), apisClientTs)
|
|
28
|
+
writeFile(p('src', 'apis', 'server', 'index.ts'), apisServerTs)
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
31
|
}
|
package/src/steps/07-proxy.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import { writeFile } from '../utils/writer.js'
|
|
3
|
-
import { safeStep } from '../utils/safe-step.js'
|
|
4
|
-
import { proxyTs } from '../templates/files.js'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @param {string} targetDir
|
|
8
|
-
* @param {{ i18n: boolean, auth: boolean }} opts
|
|
9
|
-
*/
|
|
10
|
-
export async function stepWriteProxy(targetDir, opts) {
|
|
11
|
-
if (!opts.i18n && !opts.auth) return
|
|
12
|
-
|
|
13
|
-
await safeStep('Writing Next.js middleware (proxy)', () => {
|
|
14
|
-
const p = (...parts) => path.join(targetDir, ...parts)
|
|
15
|
-
writeFile(p('src', 'proxy.ts'), proxyTs(opts))
|
|
16
|
-
})
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { writeFile } from '../utils/writer.js'
|
|
3
|
+
import { safeStep } from '../utils/safe-step.js'
|
|
4
|
+
import { proxyTs } from '../templates/files.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} targetDir
|
|
8
|
+
* @param {{ i18n: boolean, auth: boolean }} opts
|
|
9
|
+
*/
|
|
10
|
+
export async function stepWriteProxy(targetDir, opts) {
|
|
11
|
+
if (!opts.i18n && !opts.auth) return
|
|
12
|
+
|
|
13
|
+
await safeStep('Writing Next.js middleware (proxy)', () => {
|
|
14
|
+
const p = (...parts) => path.join(targetDir, ...parts)
|
|
15
|
+
writeFile(p('src', 'proxy.ts'), proxyTs(opts))
|
|
16
|
+
})
|
|
17
17
|
}
|