mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
magicthing -> astro
This commit is contained in:
parent
af6b029e95
commit
47d1c22449
6 changed files with 28 additions and 1481 deletions
10
magicthing.mjs → astro.mjs
Normal file → Executable file
10
magicthing.mjs → astro.mjs
Normal file → Executable file
|
@ -14,16 +14,16 @@ if(!root) {
|
|||
const fileProtocolRoot = `file://${root}/`;
|
||||
|
||||
async function run() {
|
||||
const magicConfig = (await import(pathJoin(root, 'magicthing.config.mjs'))).default;
|
||||
magicConfig.projectRoot = new URL(magicConfig.projectRoot + '/', fileProtocolRoot);
|
||||
magicConfig.hmxRoot = new URL(magicConfig.hmxRoot + '/', fileProtocolRoot);
|
||||
const astroConfig = (await import(pathJoin(root, 'astro.config.mjs'))).default;
|
||||
astroConfig.projectRoot = new URL(astroConfig.projectRoot + '/', fileProtocolRoot);
|
||||
astroConfig.hmxRoot = new URL(astroConfig.hmxRoot + '/', fileProtocolRoot);
|
||||
|
||||
|
||||
// Should use an args parser eventually
|
||||
if(process.argv.includes('--generate')) {
|
||||
return generate(magicConfig);
|
||||
return generate(astroConfig);
|
||||
} else {
|
||||
return devServer(magicConfig);
|
||||
return devServer(astroConfig);
|
||||
}
|
||||
}
|
||||
|
1471
package-lock.json
generated
1471
package-lock.json
generated
File diff suppressed because it is too large
Load diff
10
package.json
10
package.json
|
@ -1,16 +1,20 @@
|
|||
{
|
||||
"name": "hmx-v2",
|
||||
"name": "astro",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"author": "Fred K. Schott",
|
||||
"private": true,
|
||||
"author": "Skypack",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./magicthing.mjs",
|
||||
".": "./mastro.mjs",
|
||||
"./snowpack-plugin": "./snowpack-plugin.cjs",
|
||||
"./h": "./lib/h.js",
|
||||
"./render/preact": "./lib/render/preact.js"
|
||||
},
|
||||
"bin": {
|
||||
"astro": "astro.mjs"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc && npm run copy-js",
|
||||
"copy-js": "copyfiles -u 1 src/*.js lib/"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
export interface MagicConfigRaw {
|
||||
export interface AstroConfigRaw {
|
||||
dist: string;
|
||||
projectRoot: string;
|
||||
hmxRoot: string;
|
||||
}
|
||||
|
||||
export interface MagicConfig {
|
||||
export interface AstroConfig {
|
||||
dist: string;
|
||||
projectRoot: URL;
|
||||
hmxRoot: URL;
|
|
@ -1,4 +1,4 @@
|
|||
import type { MagicConfig } from './@types/magicthing';
|
||||
import type { AstroConfig } from './@types/astro';
|
||||
import { loadConfiguration, startServer as startSnowpackServer } from 'snowpack';
|
||||
import { existsSync, promises as fsPromises } from 'fs';
|
||||
import http from 'http';
|
||||
|
@ -11,8 +11,8 @@ const require = createRequire(import.meta.url);
|
|||
const hostname = '127.0.0.1';
|
||||
const port = 3000;
|
||||
|
||||
export default async function(magicConfig: MagicConfig) {
|
||||
const { projectRoot, hmxRoot } = magicConfig;
|
||||
export default async function(astroConfig: AstroConfig) {
|
||||
const { projectRoot, hmxRoot } = astroConfig;
|
||||
|
||||
const internalPath = new URL('./frontend/', import.meta.url);
|
||||
const snowpackConfigPath = new URL('./snowpack.config.js', projectRoot);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { MagicConfig } from './@types/magicthing';
|
||||
import type { AstroConfig } from './@types/astro';
|
||||
import { loadConfiguration, startServer as startSnowpackServer } from 'snowpack';
|
||||
import { promises as fsPromises } from 'fs';
|
||||
import { relative as pathRelative } from 'path';
|
||||
|
@ -18,10 +18,10 @@ async function* allPages(root: URL): AsyncGenerator<URL, void, unknown> {
|
|||
}
|
||||
}
|
||||
|
||||
export default async function(magicConfig: MagicConfig) {
|
||||
const { projectRoot, hmxRoot } = magicConfig;
|
||||
export default async function(astroConfig: AstroConfig) {
|
||||
const { projectRoot, hmxRoot } = astroConfig;
|
||||
const pageRoot = new URL('./pages/', hmxRoot);
|
||||
const dist = new URL(magicConfig.dist + '/', projectRoot);
|
||||
const dist = new URL(astroConfig.dist + '/', projectRoot);
|
||||
|
||||
const configPath = new URL('./snowpack.config.js', projectRoot).pathname;
|
||||
const config = await loadConfiguration({
|
||||
|
|
Loading…
Reference in a new issue