Skip to content

Commit

Permalink
renamed project
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Gräfenstein committed Mar 3, 2018
1 parent e23c46b commit 78b75d6
Show file tree
Hide file tree
Showing 127 changed files with 249 additions and 240 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Glib
[G]glib
======

[![Coverage Status](https://coveralls.io/repos/github/giniedp/glib/badge.svg?branch=master)](https://coveralls.io/github/giniedp/glib?branch=master)
Expand Down
61 changes: 35 additions & 26 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,45 @@ const del = require('del')
const path = require('path')
const glob = require('glob')
const gulp = require('gulp')
const gutil = require('gulp-util')
const shell = require('shelljs')
const rollup = require('rollup')

const dstDir = path.join(__dirname, 'dist')
const srcDir = path.join(__dirname, 'packages')

const projectName = 'gglib'
const modules = ['bundles', 'esm5', 'esm2015']
const packages = (() => {
return glob
.sync(path.join(srcDir, '*'))
.filter((it) => it.indexOf('.') === -1)
.map((it) => path.basename(it))
})()
const allPackages = [...packages, projectName]

function compileReadme(pkg) {
function compileReadme(pkg, pj) {
return `
Glib - ${pkg}
=======
[![Coverage Status](https://coveralls.io/repos/github/giniedp/glib/badge.svg?branch=master)](https://coveralls.io/github/giniedp/glib?branch=master)
[![Build Status](https://travis-ci.org/giniedp/glib.svg?branch=master)](https://travis-ci.org/giniedp/glib)
[G]glib - ${pkg}
=======
${pj.description}
To find out more about this project visit [the repository](https://github.com/giniedp/glib) or the [project page](https://glib.ginie.eu)
Licence: MIT
Licence: ${pj.license}
`.trim()
}

function findPeers(pkg) {
const src = path.join(srcDir, pkg)
const result = []
glob.sync(`${src}/**/*.ts`).forEach((file) => {
const match = fs.readFileSync(file).toString().match(/from '@glib\/(\w+)'/g);
const match = fs.readFileSync(file).toString().match(/from '@gglib\/(\w+)'/g);

(match || []).forEach((value) => {
const m = value.match(/from '@glib\/(\w+)'/)
const m = value.match(/from '@gglib\/(\w+)'/)
if (!m || !m[1]) {
return
}
Expand All @@ -51,7 +53,7 @@ function findPeers(pkg) {
}
})
})
return result.map((it) => `@glib/${it}`)
return result.map((it) => `@gglib/${it}`)
}


Expand All @@ -76,7 +78,7 @@ gulp.task('build:tsc:esm2015', ['clean'], (cb) => {
})

const rollupTasks = []
for (const p of [...packages, 'glib']) {
for (const p of allPackages) {
const pkgName = p
const taskName = `build:rollup:${pkgName}`
rollupTasks.push(taskName)
Expand All @@ -87,11 +89,11 @@ for (const p of [...packages, 'glib']) {
const globals = {}
const aliase = {}
for (const name of packages) {
globals[`@glib/${name}`] = `glib.${name}`
aliase[`@glib/${name}`] = path.join(dstDir, 'esm5', name, 'index.js')
globals[`@gglib/${name}`] = `gg.${name}`
aliase[`@gglib/${name}`] = path.join(dstDir, 'esm5', name, 'index.js')
}
return rollup.rollup(pkgName === 'glib'? {
amd: {id: `@glib/${pkgName}`},
return rollup.rollup(pkgName === projectName ? {
amd: {id: `@gglib/${pkgName}`},
input: path.join(dstDir, 'esm5', 'index.js'),
plugins: [resolve(), alias(aliase), sourcemaps()],
external: [],
Expand All @@ -100,7 +102,7 @@ for (const p of [...packages, 'glib']) {
warn(warning);
}
} : {
amd: {id: `@glib/${pkgName}`},
amd: {id: `@gglib/${pkgName}`},
input: path.join(dstDir, 'esm5', pkgName, 'index.js'),
plugins: [resolve(), sourcemaps()],
external: Object.keys(globals),
Expand All @@ -114,7 +116,7 @@ for (const p of [...packages, 'glib']) {
format: 'umd',
sourcemap: true,
file: path.join(dstDir, 'bundles', pkgName, pkgName + '.umd.js'),
name: `glib.${pkgName}`,
name: `gg.${pkgName}`,
globals: globals,
exports: 'named',
})
Expand All @@ -126,7 +128,7 @@ gulp.task('build:rollup', rollupTasks)

const mergeTasks = []
for (const m of modules) {
for (const p of [...packages, 'glib']) {
for (const p of allPackages) {
const pkgName = p
const moduleName = m
const taskName = `build:${moduleName}:${pkgName}`
Expand All @@ -140,20 +142,20 @@ for (const m of modules) {
}

gulp.task('build', mergeTasks, () => {
[...packages, 'glib'].forEach((pkg) => {
allPackages.forEach((pkg) => {
const pkgDir = path.join(dstDir, 'packages', pkg);
const pkgPath = path.join(pkgDir, 'package.json')
const pkgJson = require(path.join(__dirname, 'package.json'))
const readmePath = path.join(pkgDir, 'README.md')

// create missing files
fs.writeFileSync(pkgPath, '')
fs.writeFileSync(path.join(pkgDir, 'README.md'), compileReadme(pkg))
fs.writeFileSync(readmePath, '')

// generate pkgJson defintion

const pkgDef = {
name: `@glib/${pkg}`,
description: 'Part of the glib Project',
name: `@gglib/${pkg}`,
description: 'Part of the [G]glib project',
version: pkgJson.version,
repository: pkgJson.repository,
keywords: pkgJson.keywords,
Expand All @@ -163,27 +165,34 @@ gulp.task('build', mergeTasks, () => {
module: './esm5/index.js',
es2015: './esm2015/index.js',
typings: './esm2015/index.d.ts',
scripts: {},
files: glob
.sync(path.join(pkgDir, '*'))
.map((it) => it.replace(pkgDir + '/', '')),
scripts: {},
peerDependencies: {},
dependencies: {},
devDependencies: {},
}
findPeers(pkg).forEach((it) => {
pkgDef.peerDependencies[it] = pkgDef.version
})

if (pkg === 'glib') {
if (pkg === projectName) {
pkgDef.module = pkgDef.main
delete pkgDef.es2015
delete pkgDef.typings
pkgDef.description = 'Standalone version of the glib Project'
pkgDef.description = 'Standalone version of the [G]glib project'
}

// write files
fs.writeFileSync(pkgPath, JSON.stringify(pkgDef, null, 2))
fs.writeFileSync(readmePath, compileReadme(pkg, pkgDef))
})

modules.forEach((name) => del(path.join(dstDir, name)))
})

gulp.task('publish', ['build'], () => {
allPackages.forEach((name) => {
shell.exec(`npm publish ./dist/packages/${name} --access=public`, { async: true })
})
})
2 changes: 1 addition & 1 deletion packages/content/src/BinaryReader.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tslint:disable no-bitwise

import { BinaryReader } from '@glib/content'
import { BinaryReader } from '@gglib/content'
describe('Glib.Content.BinaryReader', () => {
let data
let reader: BinaryReader
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/Manager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// tslint:disable ban-types
// tslint:disable max-classes-per-file

import { DataUri, extend, Http, HttpOptions, isArray, isObject, isString, Log, pick, Uri } from '@glib/core'
import { Device } from '@glib/graphics'
import { DataUri, extend, Http, HttpOptions, isArray, isObject, isString, Log, pick, Uri } from '@gglib/core'
import { Device } from '@gglib/graphics'
import { ContentType } from './ContentType'
import { Pipeline, PipelineContext, PipelineHandler } from './Pipeline'

Expand Down
2 changes: 1 addition & 1 deletion packages/content/src/Pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// tslint:disable ban-types
import { DataUri, Log, Uri } from '@glib/core'
import { DataUri, Log, Uri } from '@gglib/core'
import { ContentType } from './ContentType'
import { Manager, RawAsset } from './Manager'
import { Parser } from './parser'
Expand Down
6 changes: 3 additions & 3 deletions packages/content/src/importer/daeModel.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { extend, Uri } from '@glib/core'
import { extend, Uri } from '@gglib/core'
import {
DataSize,
DataType,
Model,
ModelBuilder,
ModelMeshOptions,
PrimitiveType,
VertexLayout } from '@glib/graphics'
import { IVec3, Mat4, Quat, Vec3 } from '@glib/math'
VertexLayout } from '@gglib/graphics'
import { IVec3, Mat4, Quat, Vec3 } from '@gglib/math'

import { Pipeline, PipelineContext, pipelineImporter, pipelinePreprocessor, pipelineProcessor } from '../Pipeline'
import * as DAE from './../parser/dae'
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/fbxModel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extend, Http, HttpOptions, Log, WebWorker } from '@glib/core'
import { Model, ModelBuilder } from '@glib/graphics'
import { extend, Http, HttpOptions, Log, WebWorker } from '@gglib/core'
import { Model, ModelBuilder } from '@gglib/graphics'
import { FBX } from '../parser'
import { Pipeline, PipelineContext, pipelineImporter, pipelineLoader, pipelinePreprocessor, pipelineProcessor } from '../Pipeline'
import { RawAsset } from './../Manager'
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/image.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, Texture, TextureType } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, Texture, TextureType } from '@gglib/graphics'

// tslint:disable-next-line
const RED10x20 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAYAAAC07qxWAAAAGElEQVR42mP8z8AARIQB46jCUYWjCkEAAMXUJ+1sUc+CAAAAAElFTkSuQmCC'
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/imageData.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, Texture, TextureType } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, Texture, TextureType } from '@gglib/graphics'

// tslint:disable-next-line
const RED10x20 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAYAAAC07qxWAAAAGElEQVR42mP8z8AARIQB46jCUYWjCkEAAMXUJ+1sUc+CAAAAAElFTkSuQmCC'
Expand Down
2 changes: 1 addition & 1 deletion packages/content/src/importer/imageData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Http, HttpOptions, Log } from '@glib/core'
import { Http, HttpOptions, Log } from '@gglib/core'
import { PipelineContext, pipelineLoader, pipelineProcessor } from '../Pipeline'
import { TGA } from './../parser/TGA'

Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/jsonEffect.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, ShaderEffect } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, ShaderEffect } from '@gglib/graphics'

describe('glib/content/manager/importer', () => {

Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/jsonEffect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShaderEffect, ShaderPassOptions, ShaderTechniqueOptions } from '@glib/graphics'
import { ShaderEffect, ShaderPassOptions, ShaderTechniqueOptions } from '@gglib/graphics'
import { JSON } from '../parser'
import { Pipeline, PipelineContext, pipelineImporter, pipelinePreprocessor, pipelineProcessor } from '../Pipeline'

Expand Down Expand Up @@ -58,7 +58,7 @@ pipelinePreprocessor(ShaderEffect, (context: PipelineContext): Promise<void> =>
})
})

import { extend, Uri } from '@glib/core'
import { extend, Uri } from '@gglib/core'

let regInclude = /#include\s+<(.*)>/
let charNewLine = '\n'
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/jsonMaterial.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, ShaderEffect } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, ShaderEffect } from '@gglib/graphics'

describe('glib/content/manager/importer', () => {

Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/jsonMaterial.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extend, Log, Uri } from '@glib/core'
import { ShaderEffect } from '@glib/graphics'
import { extend, Log, Uri } from '@gglib/core'
import { ShaderEffect } from '@gglib/graphics'
import { Pipeline, PipelineContext, pipelineImporter, pipelinePreprocessor, pipelineProcessor } from '../Pipeline'

pipelineImporter(['.json', 'application/json'], 'Material[]', (context: PipelineContext): Promise<void> => {
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/jsonModel.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, Model, ShaderEffect } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, Model, ShaderEffect } from '@gglib/graphics'

describe('glib/content/manager/importer', () => {

Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/jsonModel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extend, Uri } from '@glib/core'
import { Model } from '@glib/graphics'
import { extend, Uri } from '@gglib/core'
import { Model } from '@gglib/graphics'
import { Pipeline, PipelineContext, pipelineImporter, pipelinePreprocessor, pipelineProcessor } from '../Pipeline'

pipelineImporter(['.json', 'application/json'], Model, (context: PipelineContext) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/mltMaterial.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, ShaderEffect } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, ShaderEffect } from '@gglib/graphics'

// tslint:disable-next-line
const RED10x20 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAYAAAC07qxWAAAAGElEQVR42mP8z8AARIQB46jCUYWjCkEAAMXUJ+1sUc+CAAAAAElFTkSuQmCC'
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/mtlMaterial.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extend } from '@glib/core'
import { ShaderEffectOptions } from '@glib/graphics'
import { extend } from '@gglib/core'
import { ShaderEffectOptions } from '@gglib/graphics'
import { MTL, MtlData } from '../parser'
import { Pipeline, PipelineContext, pipelineImporter, pipelinePreprocessor, pipelineProcessor } from '../Pipeline'

Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/objModel.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, Model } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, Model } from '@gglib/graphics'

describe('glib/content/manager/importer', () => {

Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/objModel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extend, WebWorker } from '@glib/core'
import { Model, ModelBuilder, ModelOptions } from '@glib/graphics'
import { extend, WebWorker } from '@gglib/core'
import { Model, ModelBuilder, ModelOptions } from '@gglib/graphics'
import { OBJ, ObjData, ObjGroup } from '../parser'
import { Pipeline, PipelineContext, pipelineImporter, pipelinePreprocessor, pipelineProcessor } from '../Pipeline'
import { RawAsset } from './../Manager'
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/textures.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, Texture, TextureType } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, Texture, TextureType } from '@gglib/graphics'

// tslint:disable-next-line
const RED10x20 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAYAAAC07qxWAAAAGElEQVR42mP8z8AARIQB46jCUYWjCkEAAMXUJ+1sUc+CAAAAAElFTkSuQmCC'
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/textures.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Http, HttpOptions, Log } from '@glib/core'
import { Texture } from '@glib/graphics'
import { Http, HttpOptions, Log } from '@gglib/core'
import { Texture } from '@gglib/graphics'
import { Pipeline, PipelineContext, pipelineImporter, pipelineLoader, pipelinePreprocessor, pipelineProcessor } from '../Pipeline'
import { XhrAsset } from './../Manager'
import { TGA } from './../parser/TGA'
Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/video.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, Texture, TextureType } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, Texture, TextureType } from '@gglib/graphics'

describe('glib/content/manager/importer', () => {

Expand Down
4 changes: 2 additions & 2 deletions packages/content/src/importer/ymlEffect.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from '@glib/content'
import { Device, ShaderEffect } from '@glib/graphics'
import { Manager } from '@gglib/content'
import { Device, ShaderEffect } from '@gglib/graphics'

// tslint:disable-next-line
const RED10x20 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAYAAAC07qxWAAAAGElEQVR42mP8z8AARIQB46jCUYWjCkEAAMXUJ+1sUc+CAAAAAElFTkSuQmCC'
Expand Down
2 changes: 1 addition & 1 deletion packages/content/src/importer/ymlEffect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShaderEffect } from '@glib/graphics'
import { ShaderEffect } from '@gglib/graphics'

import { YML } from '../parser'
import { Pipeline, PipelineContext, pipelineImporter, pipelineLoader } from '../Pipeline'
Expand Down
2 changes: 1 addition & 1 deletion packages/content/src/parser/FBX.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://code.blender.org/2013/08/fbx-binary-file-format-specification/

import { Log } from '@glib/core'
import { Log } from '@gglib/core'
import { BinaryReader } from './../BinaryReader'

export interface FBXNode {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/DataUri.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataUri } from '@glib/core'
import { DataUri } from '@gglib/core'

describe('DataUri', () => {
describe('parse data:text/plain,Hello World', () => {
Expand Down

0 comments on commit 78b75d6

Please sign in to comment.