From c063d7a42869a3bd448076e8159a96c97ab18862 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Thu, 16 Jan 2020 12:07:08 +0800 Subject: [PATCH 1/9] feat: add rax support --- .all-contributorsrc | 9 ++++++++ packages/common/src/templates/icons.ts | 4 ++++ packages/common/src/templates/index.ts | 5 +++++ packages/common/src/templates/rax.ts | 30 ++++++++++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 packages/common/src/templates/rax.ts diff --git a/.all-contributorsrc b/.all-contributorsrc index a1f6f86bb73..ce8989a67f5 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -317,6 +317,15 @@ "bug" ] }, + { + "login": "rax-public", + "name": "Rax Team", + "avatar_url": "https://avatars3.githubusercontent.com/u/59947214?v=4", + "profile": "https://github.com/rax-public", + "contributions": [ + "code" + ] + }, { "login": "tomkuehl", "name": "Tom Kühl", diff --git a/packages/common/src/templates/icons.ts b/packages/common/src/templates/icons.ts index 5cdda8b0366..0ef29070a1d 100644 --- a/packages/common/src/templates/icons.ts +++ b/packages/common/src/templates/icons.ts @@ -6,6 +6,7 @@ import { ReasonIcon, EmberIcon, PreactIcon, + RaxIcon, VueIcon, SvelteIcon, DojoIcon, @@ -33,6 +34,7 @@ import { ember, vue, preact, + rax, reactTs, svelte, angular, @@ -68,6 +70,8 @@ export default function getIcon(theme: TemplateType) { return VueIcon; case preact.name: return PreactIcon; + case rax.name: + return RaxIcon; case reactTs.name: return ReactIcon; case svelte.name: diff --git a/packages/common/src/templates/index.ts b/packages/common/src/templates/index.ts index e6cbb01f346..7327efba6a5 100644 --- a/packages/common/src/templates/index.ts +++ b/packages/common/src/templates/index.ts @@ -3,6 +3,7 @@ import angular from './angular'; import babel from './babel'; import parcel from './parcel'; import preact from './preact'; +import rax from './rax'; import reason from './reason'; import react from './react'; import reactTs from './react-ts'; @@ -43,6 +44,7 @@ export { dojo, parcel, preact, + rax, react, reactTs, reason, @@ -65,6 +67,7 @@ export type TemplateType = | 'create-react-app' | 'vue-cli' | 'preact-cli' + | 'rax-cli' | 'svelte' | 'create-react-app-typescript' | 'angular-cli' @@ -101,6 +104,8 @@ export default function getDefinition(theme?: TemplateType) { return vue; case preact.name: return preact; + case rax.name: + return rax; case reactTs.name: return reactTs; case svelte.name: diff --git a/packages/common/src/templates/rax.ts b/packages/common/src/templates/rax.ts new file mode 100644 index 00000000000..b821513c630 --- /dev/null +++ b/packages/common/src/templates/rax.ts @@ -0,0 +1,30 @@ +import Template, { ParsedConfigurationFiles } from './template'; +import { decorateSelector } from '../utils/decorate-selector'; +import configurations from './configuration'; + +class RaxTemplate extends Template { + getEntries(configurationFiles: ParsedConfigurationFiles) { + const entries = super.getEntries(configurationFiles); + + entries.push('/src/app.js'); + return entries; + } +} + +export default new RaxTemplate( + 'rax-cli', + 'Rax', + 'https://github.com/raxjs/rax-scripts/tree/master/packages/rax-cli', + 'rax', + decorateSelector(() => '#FFB006'), + { + showOnHomePage: true, + extraConfigurations: { + '/.babelrc': configurations.babelrc, + }, + distDir: 'build', + main: true, + popular: true, + mainFile: ['/src/app.js'], + } +); From 3939f1c24ca89aadd6cc53a05e9ca068f28660c7 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Thu, 16 Jan 2020 12:48:57 +0800 Subject: [PATCH 2/9] feat: remove not exist icon --- packages/common/src/templates/icons.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/common/src/templates/icons.ts b/packages/common/src/templates/icons.ts index 0ef29070a1d..234440f35d8 100644 --- a/packages/common/src/templates/icons.ts +++ b/packages/common/src/templates/icons.ts @@ -6,7 +6,7 @@ import { ReasonIcon, EmberIcon, PreactIcon, - RaxIcon, + // RaxIcon, VueIcon, SvelteIcon, DojoIcon, @@ -70,8 +70,8 @@ export default function getIcon(theme: TemplateType) { return VueIcon; case preact.name: return PreactIcon; - case rax.name: - return RaxIcon; + // case rax.name: + // return RaxIcon; case reactTs.name: return ReactIcon; case svelte.name: From 82a40cd76c0991a38d734d641ff751a0f01361d2 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Thu, 16 Jan 2020 12:50:44 +0800 Subject: [PATCH 3/9] feat: remove unused import --- packages/common/src/templates/icons.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/src/templates/icons.ts b/packages/common/src/templates/icons.ts index 234440f35d8..8dbc6c94097 100644 --- a/packages/common/src/templates/icons.ts +++ b/packages/common/src/templates/icons.ts @@ -34,7 +34,7 @@ import { ember, vue, preact, - rax, + // rax, reactTs, svelte, angular, From 4844dfbf817d617797b637b3830b00452a2c4fce Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Thu, 16 Jan 2020 14:34:37 +0800 Subject: [PATCH 4/9] feat: update template --- packages/common/src/templates/rax.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/src/templates/rax.ts b/packages/common/src/templates/rax.ts index b821513c630..e07cb21d585 100644 --- a/packages/common/src/templates/rax.ts +++ b/packages/common/src/templates/rax.ts @@ -15,7 +15,7 @@ export default new RaxTemplate( 'rax-cli', 'Rax', 'https://github.com/raxjs/rax-scripts/tree/master/packages/rax-cli', - 'rax', + 'github/raxjs/rax-codesandbox-template', decorateSelector(() => '#FFB006'), { showOnHomePage: true, From ae819f89ef9ac0bd41d091dc7689b4d559ee4854 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Thu, 16 Jan 2020 14:51:20 +0800 Subject: [PATCH 5/9] feat: change options like vuepress --- packages/common/src/templates/rax.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/common/src/templates/rax.ts b/packages/common/src/templates/rax.ts index e07cb21d585..455bccb30a8 100644 --- a/packages/common/src/templates/rax.ts +++ b/packages/common/src/templates/rax.ts @@ -1,6 +1,5 @@ import Template, { ParsedConfigurationFiles } from './template'; import { decorateSelector } from '../utils/decorate-selector'; -import configurations from './configuration'; class RaxTemplate extends Template { getEntries(configurationFiles: ParsedConfigurationFiles) { @@ -14,17 +13,12 @@ class RaxTemplate extends Template { export default new RaxTemplate( 'rax-cli', 'Rax', - 'https://github.com/raxjs/rax-scripts/tree/master/packages/rax-cli', + 'https://rax.js.org/', 'github/raxjs/rax-codesandbox-template', decorateSelector(() => '#FFB006'), { - showOnHomePage: true, - extraConfigurations: { - '/.babelrc': configurations.babelrc, - }, - distDir: 'build', - main: true, - popular: true, mainFile: ['/src/app.js'], + distDir: 'build', + showOnHomePage: true, } ); From 8c6ebffc4eb47c08cf336668e5798d138da66053 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Thu, 16 Jan 2020 15:34:14 +0800 Subject: [PATCH 6/9] feat: add isServer --- packages/common/src/components/SandboxCard/fixtures.ts | 1 + packages/common/src/templates/helpers/is-server.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/common/src/components/SandboxCard/fixtures.ts b/packages/common/src/components/SandboxCard/fixtures.ts index 4e0f85b737b..123c34d42a0 100644 --- a/packages/common/src/components/SandboxCard/fixtures.ts +++ b/packages/common/src/components/SandboxCard/fixtures.ts @@ -129,6 +129,7 @@ export const templates: TemplateType[] = [ 'create-react-app', 'vue-cli', 'preact-cli', + 'rax-cli', 'svelte', 'create-react-app-typescript', 'angular-cli', diff --git a/packages/common/src/templates/helpers/is-server.ts b/packages/common/src/templates/helpers/is-server.ts index 2ea5d58c68e..4cf5378b745 100644 --- a/packages/common/src/templates/helpers/is-server.ts +++ b/packages/common/src/templates/helpers/is-server.ts @@ -13,6 +13,7 @@ const SERVER_TEMPLATE_NAMES = [ 'node', 'nuxt', 'quasar-framework', + 'rax-cli', 'sapper', 'styleguidist', 'unibit', From 64c4f5c31a5b19a3d858a38478e32245ea3dd28c Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Thu, 16 Jan 2020 15:52:55 +0800 Subject: [PATCH 7/9] feat: update rax-cli to rax --- .../src/components/SandboxCard/fixtures.ts | 2 +- .../common/src/templates/helpers/is-server.ts | 2 +- packages/common/src/templates/index.ts | 4 ++-- packages/common/src/templates/rax.ts | 19 ++++++++----------- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/packages/common/src/components/SandboxCard/fixtures.ts b/packages/common/src/components/SandboxCard/fixtures.ts index 123c34d42a0..39be9485612 100644 --- a/packages/common/src/components/SandboxCard/fixtures.ts +++ b/packages/common/src/components/SandboxCard/fixtures.ts @@ -129,7 +129,7 @@ export const templates: TemplateType[] = [ 'create-react-app', 'vue-cli', 'preact-cli', - 'rax-cli', + 'rax', 'svelte', 'create-react-app-typescript', 'angular-cli', diff --git a/packages/common/src/templates/helpers/is-server.ts b/packages/common/src/templates/helpers/is-server.ts index 4cf5378b745..a619e304dec 100644 --- a/packages/common/src/templates/helpers/is-server.ts +++ b/packages/common/src/templates/helpers/is-server.ts @@ -13,7 +13,7 @@ const SERVER_TEMPLATE_NAMES = [ 'node', 'nuxt', 'quasar-framework', - 'rax-cli', + 'rax', 'sapper', 'styleguidist', 'unibit', diff --git a/packages/common/src/templates/index.ts b/packages/common/src/templates/index.ts index 7327efba6a5..c3892bc6caa 100644 --- a/packages/common/src/templates/index.ts +++ b/packages/common/src/templates/index.ts @@ -67,7 +67,7 @@ export type TemplateType = | 'create-react-app' | 'vue-cli' | 'preact-cli' - | 'rax-cli' + | 'rax' | 'svelte' | 'create-react-app-typescript' | 'angular-cli' @@ -105,7 +105,7 @@ export default function getDefinition(theme?: TemplateType) { case preact.name: return preact; case rax.name: - return rax; + return rax; case reactTs.name: return reactTs; case svelte.name: diff --git a/packages/common/src/templates/rax.ts b/packages/common/src/templates/rax.ts index 455bccb30a8..8bb885926eb 100644 --- a/packages/common/src/templates/rax.ts +++ b/packages/common/src/templates/rax.ts @@ -1,24 +1,21 @@ -import Template, { ParsedConfigurationFiles } from './template'; +import Template from './template'; import { decorateSelector } from '../utils/decorate-selector'; -class RaxTemplate extends Template { - getEntries(configurationFiles: ParsedConfigurationFiles) { - const entries = super.getEntries(configurationFiles); - - entries.push('/src/app.js'); - return entries; +export class RaxTemplate extends Template { + // The file to open by the editor + getDefaultOpenedFiles() { + return ['/src/app.js']; } } - export default new RaxTemplate( - 'rax-cli', + 'rax', 'Rax', 'https://rax.js.org/', 'github/raxjs/rax-codesandbox-template', decorateSelector(() => '#FFB006'), { - mainFile: ['/src/app.js'], - distDir: 'build', showOnHomePage: true, + distDir: 'build', + mainFile: [] } ); From 6c69150fbb371fe21029aaec29c80f19cce57610 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Mon, 3 Feb 2020 09:49:33 +0800 Subject: [PATCH 8/9] feat: update icons --- packages/common/src/templates/icons.ts | 4 ++-- packages/common/src/templates/iconsDark.ts | 4 ++++ packages/common/src/templates/iconsLight.ts | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/common/src/templates/icons.ts b/packages/common/src/templates/icons.ts index 8dbc6c94097..c63fd2c0bea 100644 --- a/packages/common/src/templates/icons.ts +++ b/packages/common/src/templates/icons.ts @@ -34,7 +34,7 @@ import { ember, vue, preact, - // rax, + rax, reactTs, svelte, angular, @@ -70,7 +70,7 @@ export default function getIcon(theme: TemplateType) { return VueIcon; case preact.name: return PreactIcon; - // case rax.name: + case rax.name: // return RaxIcon; case reactTs.name: return ReactIcon; diff --git a/packages/common/src/templates/iconsDark.ts b/packages/common/src/templates/iconsDark.ts index 39b488e5209..6e894ca772c 100644 --- a/packages/common/src/templates/iconsDark.ts +++ b/packages/common/src/templates/iconsDark.ts @@ -6,6 +6,7 @@ import { ReasonIconDark, EmberIconDark, PreactIconDark, + // RaxIconDark, VueIconDark, SvelteIconDark, DojoIconDark, @@ -33,6 +34,7 @@ import { ember, vue, preact, + rax, reactTs, svelte, angular, @@ -68,6 +70,8 @@ export default function getIcon(theme: TemplateType) { return VueIconDark; case preact.name: return PreactIconDark; + case rax.name: + // return RaxIconDark; case reactTs.name: return ReactIconDark; case svelte.name: diff --git a/packages/common/src/templates/iconsLight.ts b/packages/common/src/templates/iconsLight.ts index 58d795919c8..f9115487300 100644 --- a/packages/common/src/templates/iconsLight.ts +++ b/packages/common/src/templates/iconsLight.ts @@ -6,6 +6,7 @@ import { ReasonIconLight, EmberIconLight, PreactIconLight, + // RaxIconLight, VueIconLight, SvelteIconLight, DojoIconLight, @@ -33,6 +34,7 @@ import { ember, vue, preact, + rax, reactTs, svelte, angular, @@ -68,6 +70,8 @@ export default function getIcon(theme: TemplateType) { return VueIconLight; case preact.name: return PreactIconLight; + case rax.name: + // return RaxIconLight; case reactTs.name: return ReactIconLight; case svelte.name: From 8f52f4103860935d698910eaa81fcaad54eeba60 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Mon, 3 Feb 2020 09:59:16 +0800 Subject: [PATCH 9/9] feat: update lint error --- packages/common/src/templates/icons.ts | 3 ++- packages/common/src/templates/iconsDark.ts | 3 ++- packages/common/src/templates/iconsLight.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/common/src/templates/icons.ts b/packages/common/src/templates/icons.ts index c63fd2c0bea..f84635771c9 100644 --- a/packages/common/src/templates/icons.ts +++ b/packages/common/src/templates/icons.ts @@ -71,7 +71,8 @@ export default function getIcon(theme: TemplateType) { case preact.name: return PreactIcon; case rax.name: - // return RaxIcon; + // return RaxIcon; + return ReactIcon; case reactTs.name: return ReactIcon; case svelte.name: diff --git a/packages/common/src/templates/iconsDark.ts b/packages/common/src/templates/iconsDark.ts index 6e894ca772c..e434630fda5 100644 --- a/packages/common/src/templates/iconsDark.ts +++ b/packages/common/src/templates/iconsDark.ts @@ -71,7 +71,8 @@ export default function getIcon(theme: TemplateType) { case preact.name: return PreactIconDark; case rax.name: - // return RaxIconDark; + // return RaxIconDark; + return ReactIconDark; case reactTs.name: return ReactIconDark; case svelte.name: diff --git a/packages/common/src/templates/iconsLight.ts b/packages/common/src/templates/iconsLight.ts index f9115487300..ed2bba016fc 100644 --- a/packages/common/src/templates/iconsLight.ts +++ b/packages/common/src/templates/iconsLight.ts @@ -71,7 +71,8 @@ export default function getIcon(theme: TemplateType) { case preact.name: return PreactIconLight; case rax.name: - // return RaxIconLight; + // return RaxIconLight; + return ReactIconLight; case reactTs.name: return ReactIconLight; case svelte.name: